Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8749859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:45:51+00:00 2026-06-13T12:45:51+00:00

I have created a gwt application with charts in it and have deployed it

  • 0

I have created a gwt application with charts in it and have deployed it in Tomcat.
I am able to display the charts with static data.

I am making rpc call to get data from the database.I want to use this data to draw charts.
But when I deploy and run my application in tomcat,charts are not displayed.The chart caption is displayed and “no data” message is shown instead of chart.

But I can display the retrieved data in an alert box.This means RPC is successful.

Below is the snippet of code I used :

public class MyGWTApp implements EntryPoint {

    /**
     * Create a remote service proxy to talk to the server-side Greeting service.
     */
    private final DataServiceAsync dataService = GWT
            .create(DataService.class);


    /**
     * This is the entry point method.
     */
    @SuppressWarnings("deprecation")
    public void onModuleLoad() {

        Runnable onLoadCallback=new Runnable(){

            public void run()
            {       


                TabPanel tabPanel = new TabPanel();
                //tabPanel.setAnimationDuration(1000);
                tabPanel.getElement().getStyle().setMarginBottom(10.0, Unit.PX);
                tabPanel.setSize("100%", "100%");


                //code to populate datatable and setting options for motion chart here


                final MotionChart motionchart=new MotionChart(data, options);
                final ColumnChart columnchart=new ColumnChart(createCategoryTable(),createCategoryBarOptions());
                final ColumnChart columnchart2=new ColumnChart(createCategoryTable(),createCategoryBarOptions());
                final ColumnChart columnchart3=new ColumnChart(createCategoryTable(),createCategoryBarOptions());

                final PieChart pie=new PieChart(createSentimentTable(), createSentimentPieOptions());

                FlexTable flexTable=new FlexTable();
                FlexCellFormatter flexCellFormatter=flexTable.getFlexCellFormatter();

                flexCellFormatter.setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER);
                flexCellFormatter.setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_MIDDLE);
                //flexTable.addStyleName("cw-FlexTable");

                flexCellFormatter.setColSpan(0, 0, 2);


                flexTable.setWidget(0, 0, pie);
                flexTable.setWidget(1, 0,columnchart2);
                flexTable.setWidget(1, 1, columnchart3);

                FlexTable flexTable2=new FlexTable();
                FlexCellFormatter flexCellFormatter2=flexTable.getFlexCellFormatter();

                flexCellFormatter2.setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER);
                flexCellFormatter2.setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_MIDDLE);
                flexTable2.setWidget(0, 0, motionchart);


                //tabPanel.add(new HTML("Testing tab panel"),"Text");
                tabPanel.add(flexTable,"Charts");
                tabPanel.add(flexTable2,"Motion Chart");

                /*tabPanel.setHeight("600");
                tabPanel.setWidth("900");*/
                tabPanel.selectTab(0);


                RootPanel.get("motionChartContainer").add(tabPanel);
            }
        };


        VisualizationUtils.loadVisualizationApi(onLoadCallback, MotionChart.PACKAGE,ColumnChart.PACKAGE);


    }

code to get data through GWt-RPC

private AbstractDataTable createCategoryTable(){

          final DataTable data = DataTable.create();

          data.addColumn(ColumnType.STRING, "Category");
          data.addColumn(ColumnType.NUMBER,"TweetCount");

          //dataService.getRowIDData(input, callback)

          dataService.getRowIDData("category",
                    new AsyncCallback<List<Record>>(){
                        public void onFailure(Throwable caught) {
                            // Show the RPC error message to the user
                            System.out.println("RPC Call failed");
                            Window.alert("category : RPC call failed");
                        }

                        public void onSuccess(List<Record> result) {

                            data.addRows(result.size());

                            String msg;
                            msg=result.size()+"\n";
                            System.out.println(msg);

                            for(int i=0;i<result.size();i++)
                            {
                                data.setValue(i,0,result.get(i).getQualifier());
                                data.setValue(i,1,Integer.parseInt(result.get(i).getValue()));  

                                msg="\n"+" Qualifier : "+result.get(i).getQualifier()+"Value : "+Integer.parseInt(result.get(i).getValue());

                            }

                            Window.alert("category : RPC Call successfull :size"+ result.size()+"\n "+ msg);

                        }
                    });  


          return data;

      }

and

private AbstractDataTable createSentimentTable(){

           final DataTable data = DataTable.create();

           //final DataTable dTable = DataTable.create(jso);

           data.addColumn(ColumnType.STRING,"Sentiment");
           data.addColumn(ColumnType.NUMBER,"TweetCount");

           dataService.getRowIDData("sentiment",
                    new AsyncCallback<List<Record>>(){
                        public void onFailure(Throwable caught) {
                            // Show the RPC error message to the user
                            System.out.println("RPC Call failed");
                            Window.alert("Sentiment : RPC call failed");
                        }

                        public void onSuccess(List<Record> result) {

                            data.addRows(result.size());
                            String msg=result.size()+"\n";
                            System.out.println(msg);

                            for(int i=0;i<result.size();i++)
                            {
                                data.setValue(i,0,result.get(i).getQualifier());
                                data.setValue(i,1,Integer.parseInt(result.get(i).getValue()));  

                                msg="\n"+" Qualifier : "+result.get(i).getQualifier()+"Value : "+Integer.parseInt(result.get(i).getValue());

                            }

                            Window.alert("Sentiment :RPC Call successfull "+ msg);
                        }
                    });  

          return data;    

      }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T12:45:51+00:00Added an answer on June 13, 2026 at 12:45 pm

    The problem lies in the line

    final ColumnChart columnchart=new ColumnChart(createCategoryTable(),createCategoryBarOptions());
    

    createCategoryTable() method does not wait till the RPC success method executes as it is asynchronous. So it will return empty data table.

    The solution is to create ColumnCharts without data and options intially.

    final ColumnChart columnchart=new ColumnChart();
    

    In the RPC onSuccess() method, you can draw the chart as:

    columnchart.draw(dataTable, options);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a JSP / servlets application running in Tomcat 7. It runs
I have a view that I created in my GWT application and I would
I have a GWT application that created an XML structure and then posts this
I have a GWT application, I created appBlueTheme.jar,appOrangeTheme.jar and added to BuildPath of project.
I have created two java class with UIBinder in GWT application. I want to
I have created one GWT sample project for Web Application. I have also created
I have a GWT application that displays some charts rendered by JFreeChart. Every few
Hi I have created an ajax application using GWT. And I have created just
I have created one simple GWT application.I have created build.xml. But when I run
I have a very simple GWT application which collects some data and provides a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.