you are missing gauge.draw(updateDataTable(load), createOptions)

in other words, the gauge should actually be drawn in your AsyncCallback to
your SystemResourceAsync object.

On Tue, Jul 14, 2009 at 4:33 AM, Vinicius Carvalho <
[email protected]> wrote:

>
> Hello there! I'm trying to get the Gauge GWT API to work, but after
> running my app on my server (not on hosted mode, since I'm running
> linux and hosted may have problems with SVG right?). I don't see
> anything. Here's the code I'm using:
>
> public class GWTTest implements EntryPoint {
>        private SystemResourceAsync service = GWT.create
> (SystemResource.class);
>        private FlowPanel layout;
>        private AbstractDataTable dataTable;
>        private Gauge gauge;
>
>        public void onModuleLoad() {
>                layout = new FlowPanel();
>                Label loadLabel = new Label("System Load");
>                Runnable onCallback = new Runnable(){
>
>                        @Override
>                        public void run() {
>                                gauge = new Gauge();
>                                RootPanel.get("content").add(gauge);
>
>                        }
>
>                };
>                VisualizationUtils.loadVisualizationApi(onCallback,
> Gauge.PACKAGE);
>        }
>
>        private Options createOptions() {
>                Options options = Gauge.Options.create();
>                options.setGaugeRange(0, 100);
>                options.setGreenRange(0, 95);
>                options.setYellowRange(26, 75);
>                options.setRedRange(76, 100);
>                options.setSize(400,120);
>                options.setMinorTicks(5);
>                return options;
>          }
>
>        private AbstractDataTable updateDataTable(SystemLoad load){
>                 DataTable data = DataTable.create();
>                 data.addColumn(ColumnType.STRING,"Label");
>                 data.addColumn(ColumnType.NUMBER,"Value");
>                 data.addRows(2);
>                 data.setValue(0, 0, "CPU");
>                 data.setValue(0, 1, (int)(load.getCpuUsage()*100));
>                 data.setValue(1, 0, "Memory");
>                 data.setValue(1, 1, (int)(load.getMemUsage()*100));
>                 return data;
>
>        }
>
> What am I missing here?
>
> Regards
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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