hi all,
i tried but the motion chart doesn't seems to appear when load with
ajaxloader. please advise me. below is my code:
public void onModuleLoad() {
verticalPanel.getElement().getStyle().setPropertyPx("margin",
10);
verticalPanel.setSpacing(10);
RootPanel.get().add(verticalPanel);
AjaxLoaderOptions options = AjaxLoaderOptions.newInstance();
options.setPackages("motionchart");
AjaxLoader.loadApi("visualization", "1", new Runnable() {
public void run() {
motionChartLoaded();
}
}, options);
}
private native void nativeMakeMotionChart(Element chartDiv) /*-{
var data = new $wnd.google.visualization.DataTable();
data.addRows(6);
data.addColumn('string', 'Fruit');
data.addColumn('date', 'Date');
data.addColumn('number', 'Sales');
data.addColumn('number', 'Expenses');
data.addColumn('string', 'Location');
data.setValue(0, 0, 'Apples');
data.setValue(0, 1, new Date (1988,0,1));
data.setValue(0, 2, 1000);
data.setValue(0, 3, 300);
data.setValue(0, 4, 'East');
data.setValue(1, 0, 'Oranges');
data.setValue(1, 1, new Date (1988,0,1));
data.setValue(1, 2, 950);
data.setValue(1, 3, 200);
data.setValue(1, 4, 'West');
data.setValue(2, 0, 'Bananas');
data.setValue(2, 1, new Date (1988,0,1));
data.setValue(2, 2, 300);
data.setValue(2, 3, 250);
data.setValue(2, 4, 'West');
data.setValue(3, 0, 'Apples');
data.setValue(3, 1, new Date(1988,1,1));
data.setValue(3, 2, 1200);
data.setValue(3, 3, 400);
data.setValue(3, 4, "East");
data.setValue(4, 0, 'Oranges');
data.setValue(4, 1, new Date(1988,1,1));
data.setValue(4, 2, 900);
data.setValue(4, 3, 150);
data.setValue(4, 4, "West");
data.setValue(5, 0, 'Bananas');
data.setValue(5, 1, new Date(1988,1,1));
data.setValue(5, 2, 788);
data.setValue(5, 3, 617);
data.setValue(5, 4, "West");
var chart = new $wnd.google.visualization.MotionChart(chartDiv);
var options = {};
options['state'] ='{"iconKeySettings":[],"stateVersion":
3,"time":"notime","xAxisOption":"_NOTHING","playDuration":
15,"iconType":"BUBBLE","sizeOption":"_NOTHING","xZoomedDataMin":null,"xZoomedIn":false,"duration":
{"multiplier":1,"timeUnit":"none"},"yZoomedDataMin":null,"xLambda":
1,"colorOption":"_NOTHING","nonSelectedAlpha":0.4,"dimensions":
{"iconDimensions":
[]},"yZoomedIn":false,"yAxisOption":"_NOTHING","yLambda":
1,"yZoomedDataMax":null,"showTrails":true,"xZoomedDataMax":null};';
options['width'] = 600;
options['height'] = 400;
chart.draw(data, options);
}-*/;
private void motionChartLoaded() {
verticalPanel.add(new Label("Motion Chart"));
SimplePanel motionPanel = new SimplePanel();
nativeMakeMotionChart(motionPanel.getElement());
verticalPanel.add(motionPanel);
}
}
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---