This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes GWT and the fly likes GWT Viz API application using server data to render charts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Frameworks » GWT
Bookmark "GWT Viz API application using server data to render charts" Watch "GWT Viz API application using server data to render charts" New topic

GWT Viz API application using server data to render charts

Ankit Khujneri

Joined: Mar 04, 2010
Posts: 1

Is there any way to fetch server side data and render it to the
charting components in a GWT-VIZ API enabled app? I tried something
unsure from my side but it did not worked for me.
Scenario: Display some server data on a column chart.
This is what I tried :
public class ChartPOC implements EntryPoint{

public ArrayList<PaymentObject> plciObj = new
public ColumnChart columnChart ;
public DataTable data ;

public void onModuleLoad() {
Runnable onLoadCallback = new Runnable() {
public void run() { // this is my debug point

ColumnChart.Options options = ColumnChart.Options.create();
ColumnChart tempColumnChart = new ColumnChart(createColTable(),
createColumnOptions(options)); // this creates a column chart
columnChart = tempColumnChart;// set it to the class level chart
// Set up the callback object.
// Load the visualization api, passing the onLoadCallback to be
// when loading is done.
RootPanel rp = RootPanel.get("sampleCharting");
//rp.add(new HTML("hello"));


private ColumnChart.Options createColumnOptions(ColumnChart.Options
options) {
//ColumnChart.Options options = ColumnChart.Options.create();
options.setColors("#F778A1", "#D16587");
options.setTitle("Earning Analysis");
options.setTitle("COLUMN CHART WIDGET");
return options;

private AbstractDataTable createColTable() {
PLCIServiceAsync service = GWT.create(PLCIService.class);// This is
an Async interface
data = DataTable.create();
data.addColumn(ColumnType.STRING, "PLCI");
data.addColumn(ColumnType.NUMBER, "Payment");
// data.addColumn(ColumnType.NUMBER, "PLCI");

AsyncCallback<ArrayList<PaymentPLCIObject>> callback = new
AsyncCallback<ArrayList<PaymentPLCIObject>>() {// implement
AsyncCallback methods
public void onFailure(Throwable caught) {
// TODO: Do something with errors.

public void onSuccess(ArrayList<PaymentPLCIObject> result) {
updateTable(result);// update the DataTable with server
service.getPLCIs(callback);// call the server side service
class's method
return data;

private void updateTable(ArrayList<PaymentPLCIObject> result){
for(int index=0; index<result.size(); index++){
PaymentPLCIObject obj = (PaymentPLCIObject)result.get(index);
data.setValue(index, 0,obj.getPlciCode());
data.setValue(index, 1, obj.getPayment());



when I try to debug the app, the app fails when reaches "public void
run() {".
Any help would be appreciated


Have you checked out Aspose?
subject: GWT Viz API application using server data to render charts
jQuery in Action, 3rd edition