dynamically produce charts

9 views
Skip to first unread message

biju

unread,
Jan 20, 2010, 8:51:09 AM1/20/10
to OFCGWT
Hi,
I am new to GWT and i need to generate charts dynamically (to display
the charts on client side by interacting with server) .we are running
the project in Eclipse.
1.So could some one help me what should be the server side and client
side code
2.How to convert charts (which are created in server) into String
(serialized data) so that it can be send to client as a string?

SERVER CODE:

package space.gui.server;

public ChartWidget addPieChart(boolean inp){
ChartWidget chart = new ChartWidget();
ChartData cd = new ChartData("Sales by Region", "font-size: 14px;
font-family: Verdana; text-align: center;");
cd.setBackgroundColour("#ffffff");
PieChart pie = new PieChart();
pie.setAlpha(0.3f);
pie.setNoLabels(true);
pie.setTooltip("#label# $#val#<br>#percent#");
pie.setAnimateOnShow(true);
pie.setGradientFill(true);
pie.setColours("#ff0000", "#00ff00", "#0000ff", "#ff9900",
"#ff00ff");
pie.addSlices(new PieChart.Slice(11000, "AU"));
pie.addSlices(new PieChart.Slice(88000, "USA"));
pie.addSlices(new PieChart.Slice(62000, "UK"));
pie.addSlices(new PieChart.Slice(14000, "JP"));
pie.addSlices(new PieChart.Slice(43000, "EU"));
//ImageServiceAsync imgService = (ImageServiceAsync) GWT.create
(ImageService.class);
//ServiceDefTarget target = (ServiceDefTarget) imgService;
//target.setServiceEntryPoint("ImageService");

cd.addElements(pie);
chart.setSize("300", "300");
chart.setJsonData(cd.toString());
return chart;
}

I want to convert this chart to String and then pass to client so that
the client should be able to read and display the string as Chart.
or do youu suggest any alternative solution?

biju

unread,
Jan 20, 2010, 8:51:10 AM1/20/10
to OFCGWT
Reply all
Reply to author
Forward
0 new messages