I don't use a barchart but one of the others visualizations with GWT,
maybe this will help.

Create a Timer (com.google.gwt.user.client.Timer), use this to update
your barchart after the initial load.

On start of your Composite, call a method that does the following

1. Call a method that retrieves your data and initializes your
barchart (setServices in my code)
2. Also create a timer that will update the data for your barchart
     t = new Timer() {
        public void run() {
                retrieveGaugeData();
                if(gauge != null) {
                        gauge.draw(createGaugeData(), createGaugeOptions());
                }
        }
     };
     t.scheduleRepeating(5000);

Method setServices (retrieves data initially and initializes my
visualization)
1. Retrieves your data, I use an RPC call to pull this data from the
server which in turn pulls it from MySQL and returns it
2. Create your barchart (in my case a Gauge), note I'm also using
SmartGWT so adding it to the canvas may be a little different.
     Runnable onLoadCallback = new Runnable() {
        public void run() {
                gauge = new Gauge(createGaugeData(), createGaugeOptions());
                gauge.setWidth("80%");
                Canvas c = new Canvas();
                c.setID("sys_gauge_canvas");
                c.setWidth100();
                c.setHeight("30%");
                c.addChild(gauge);
                addMember(c, 0);
        }
     };

     VisualizationUtils.loadVisualizationApi("1.1", onLoadCallback,
Gauge.PACKAGE);



On Dec 27 2010, 2:27 am, Atif Mir <[email protected]> wrote:
> Hi All,
>
> Could some one please post some example code as how a bar chart could be
> created from datasource coming from MYSQL db or MSSQL db ?
>
> Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-visualization-api?hl=en.

Reply via email to