Example usage for com.google.gwt.visualization.client.visualizations.corechart CoreChart PACKAGE

List of usage examples for com.google.gwt.visualization.client.visualizations.corechart CoreChart PACKAGE

Introduction

In this page you can find the example usage for com.google.gwt.visualization.client.visualizations.corechart CoreChart PACKAGE.

Prototype

String PACKAGE

To view the source code for com.google.gwt.visualization.client.visualizations.corechart CoreChart PACKAGE.

Click Source Link

Usage

From source file:com.google.gwt.sample.healthyeatingapp.client.Homepage.java

public Homepage() {
    initWidget(tp);//www .  j av a2s .c o  m
    // Add a home tab
    tp.add(new FoodLog(tp).onModuleLoad(), "Food Log");
    tp.add(new SocialMedia().SocialMediaWebPageLoad(), "Social Media");
    this.rpc = (DBConnectionServiceAsync) GWT.create(DBConnectionService.class);
    ServiceDefTarget target = (ServiceDefTarget) rpc;
    String moduleRelativeURL = GWT.getModuleBaseURL() + "DBConnectionServiceImpl";
    target.setServiceEntryPoint(moduleRelativeURL);

    Runnable onLoadCallBack = new Runnable() {
        @Override
        public void run() {
            String username = Cookies.getCookie("healthy_app_user");
            rpc.getUserCalories(username, new AsyncCallback<String>() {

                @Override
                public void onFailure(Throwable caught) {
                    // Show the RPC error message to the user
                    Window.alert("No log records for user:" + Cookies.getCookie("healthy_app_user"));
                }

                @Override
                public void onSuccess(String result) {
                    // TODO Auto-generated method stub
                    DataTable data = toDataTable(result);
                    tp.add(new Graph().returnGraph(data), "Graph");
                }
            });
        }
    };

    VisualizationUtils.loadVisualizationApi(onLoadCallBack, CoreChart.PACKAGE);
}

From source file:com.google.gwt.visualization.sample.visualizationshowcase.client.Showcase.java

License:Apache License

public void onModuleLoad() {
    VisualizationUtils.loadVisualizationApi(new Runnable() {
        public void run() {
            final VerticalPanel vp = new VerticalPanel();
            vp.setSpacing(15);// w  ww  .j  a v a  2 s .  c  o m
            RootPanel.get().add(vp);
            vp.add(new HTML("The following visualizations are included in the GWT "
                    + "Visualization API in the package "
                    + "<tt>com.google.gwt.visualization.client.visualizations</tt>.  "
                    + "For a full listing of visualizations available in GWT, see <a href=" + '"'
                    + "http://code.google.com/apis/visualization/documentation/gallery.html" + '"'
                    + ">the Google Visualization API</a>."));
            LeftTabPanel tabby = new LeftTabPanel();
            vp.add(tabby);
            AnnotatedDemo annotatedWidget = new AnnotatedDemo();
            tabby.add(annotatedWidget, "AnnotatedTimeLine");
            tabby.add(new AreaDemo(), "AreaChart");
            tabby.add(new ImageAreaDemo(), "AreaChart (Image)");
            tabby.add(new BarDemo(), "BarChart");
            tabby.add(new ImageBarDemo(), "BarChart (Image)");
            tabby.add(new ColumnDemo(), "ColumnChart");
            tabby.add(new GaugeDemo(), "Gauge");
            tabby.add(new GeoDemo(), "GeoMap");
            tabby.add(new IntensityDemo(), "IntensityMap");
            tabby.add(new LineDemo(), "LineChart");
            tabby.add(new ImageLineDemo(), "LineChart (Image)");
            tabby.add(new MapDemo(), "Map");
            tabby.add(new MoneyDemo(), "MoneyChart");
            tabby.add(new MotionDemo(), "MotionChart");
            tabby.add(new OrgDemo(), "OrgChart");
            tabby.add(new PieDemo(), "PieChart");
            tabby.add(new ImagePieDemo(), "PieChart (Image)");
            tabby.add(new ImageDemo(), "RadarChart (Image)");
            tabby.add(new ScatterDemo(), "ScatterChart");
            tabby.add(new SparklineDemo(), "Sparkline (Image)");
            tabby.add(new TableDemo(), "Table");
            tabby.add(new ToolbarDemo(), "Toolbar");
            tabby.setWidget(annotatedWidget);
        }
    }, AnnotatedTimeLine.PACKAGE, CoreChart.PACKAGE, Gauge.PACKAGE, GeoMap.PACKAGE, ImageChart.PACKAGE,
            ImageLineChart.PACKAGE, ImageAreaChart.PACKAGE, ImageBarChart.PACKAGE, ImagePieChart.PACKAGE,
            IntensityMap.PACKAGE, MapVisualization.PACKAGE, MotionChart.PACKAGE, OrgChart.PACKAGE,
            Table.PACKAGE, ImageSparklineChart.PACKAGE);
}

From source file:com.java33.vizpres.client.view.visualization.GoogleCharts.java

License:Open Source License

@UiConstructor
public GoogleCharts(final int width, final int height) {
    this.width = width;
    this.height = height;
    initWidget(root);/*from www .  j  a va 2s.  c om*/
    VisualizationUtils.loadVisualizationApi(new Runnable() {
        @Override
        public void run() {
            GoogleCharts.this.chart = makeChart();
            root.add(chart);
        }
    }, CoreChart.PACKAGE);
}

From source file:org.ow2.proactive_grid_cloud_portal.rm.client.RMPage.java

License:Open Source License

private Canvas buildBotPane() {
    final HLayout hl = new HLayout();
    hl.setWidth100();// ww w  .j  a  v  a2s  .  co m
    hl.setHeight100();

    this.infoView = new InfoView(controller);
    this.statsView = new StatisticsView(controller);
    this.scriptConsoleView = new ScriptConsoleView(controller);

    final Canvas infoCanvas = this.infoView.build();
    Canvas statsCanvas = this.statsView.build();
    Canvas scriptConsoleCanvas = this.scriptConsoleView.build();

    Tab t1 = new Tab("Selection");
    t1.setPane(infoCanvas);
    Tab t2 = new Tab("Nodes");
    t2.setPane(statsCanvas);

    Tab t3 = new Tab("Script Console");
    t3.setPane(scriptConsoleCanvas);

    final TabSet leftTabs = new TabSet();
    leftTabs.setWidth("50%");
    leftTabs.setShowResizeBar(true);
    leftTabs.setTabs(t1, t2, t3);

    hl.addMember(leftTabs);

    // in offline charts are not displayed
    VisualizationUtils.loadVisualizationApi(new Runnable() {
        @Override
        public void run() {
            Tab t3 = new Tab("Monitoring");
            monitoringView = new MonitoringView(controller);
            Canvas monitoringCanvas = monitoringView.build();
            t3.setPane(monitoringCanvas);
            leftTabs.addTab(t3);

            rmStatsView = new RMStatsView(controller);
            final Canvas rmStatsCanvas = rmStatsView.build();
            rmStatsCanvas.setWidth("50%");
            hl.addMember(rmStatsCanvas);
        }
    }, CoreChart.PACKAGE);

    return hl;
}

From source file:org.ow2.proactive_grid_cloud_portal.scheduler.client.UsageView.java

License:Open Source License

public Layout build() {
    final VLayout root = new VLayout();
    root.setWidth100();//from   w  w  w.  j  ava 2  s  . c o  m
    root.setHeight100();
    // for details grid to be shown even if empty
    root.setMinMemberSize(200);

    DynamicForm dateInputs = createDateInputs();
    HLayout detailsLabelAndExportButton = createDetailsLabelAndExportButton();
    ListGrid details = createDetailsGrid();

    root.addMember(dateInputs);
    root.addMember(detailsLabelAndExportButton);
    root.addMember(details);

    VisualizationUtils.loadVisualizationApi(new Runnable() {
        @Override
        public void run() {
            Label summaryLabel = new Label("<h3>Summary</h3>");
            summaryLabel.setHeight(20);
            VLayout charts = createCharts(root);
            root.addMember(summaryLabel, 1);
            root.addMember(charts, 2);
            updateCharts();
        }
    }, CoreChart.PACKAGE);

    controller.getUsersWithJobs();
    return root;
}

From source file:org.sakaiproject.gradebook.gwt.client.gxt.view.panel.StatisticsChartPanel.java

License:Educational Community License

public StatisticsChartPanel(StatisticsChartLoaderListener statisticsChartLoaderListener,
        ChartIconPlacement chartIconPlacement, int dataAge) {

    this.statisticsChartLoaderListener = statisticsChartLoaderListener;

    // Loading visualization APIs
    VisualizationUtils.loadVisualizationApi(new VisualizationRunnable(), CoreChart.PACKAGE);

    this.i18n = Registry.get(AppConstants.I18N);
    this.i18nMessages = Registry.get(AppConstants.I18N_TEMPLATES);
    this.resources = Registry.get(AppConstants.RESOURCES);

    // Create the image icons
    columnChartIcon = new Image(resources.chart_bar());
    columnChartIcon.setStyleName(resources.css().statisticsChartIcon());
    pieChartIcon = new Image(resources.chart_pie());
    pieChartIcon.setStyleName(resources.css().statisticsChartIcon());
    lineChartIcon = new Image(resources.chart_line());
    lineChartIcon.setStyleName(resources.css().statisticsChartIcon());

    columnChartIcon.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            graphPanelContainer.removeAll();
            // GRBK-897, we set the tilt on the chart if the number of items in the chart are above a certain value
            boolean tilt = dataTable.getNumberOfRows() > tiltAfterNumberOfRows;
            graphPanelContainer.add(new ColumnChart(dataTable, createColumnChartOptions(tilt)));
            graphPanelContainer.layout();
        }/*from w  w  w .j ava  2s  .  c  om*/
    });

    lineChartIcon.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            graphPanelContainer.removeAll();
            // GRBK-897, we set the tilt on the chart if the number of items in the chart are above a certain value
            boolean tilt = dataTable.getNumberOfRows() > tiltAfterNumberOfRows;
            graphPanelContainer.add(new LineChart(dataTable, createLineChartOptions(tilt)));
            graphPanelContainer.layout();
        }
    });

    pieChartIcon.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            graphPanelContainer.removeAll();
            graphPanelContainer.add(new PieChart(dataTable, createPieChartOptions()));
            graphPanelContainer.layout();
        }
    });

    setFrame(true);
    setBodyBorder(true);

    if (AppConstants.CURRENT_STATISTICS_DATA != dataAge) {

        StringBuilder sb = new StringBuilder(i18n.statisticsChartTitle());
        sb.append(
                " <span style=\"color:black; background-color:#FDF5E6; font-weight:normal; float:right; border-radius:3px; padding:4px 5px;font-size:120%\">")
                .append(i18nMessages.statisticsDataAge(dataAge)).append("</span>");
        setHeading(sb.toString());
    } else {

        setHeading(i18n.statisticsChartTitle());
    }

    graphPanelContainer = new HorizontalPanel();

    /*
     * We allow to place the statistics' chart type icons either at the
     * bottom or on the right of the chart. The following switch statement
     * configures the containers accordingly
     */
    switch (chartIconPlacement) {

    case BOTTOM:
        chartIconPanelContainer = new HorizontalPanel();
        chartIconPanelContainer.setStyleName(resources.css().statisticsChartIconPanelContainer());
        add(graphPanelContainer);
        add(chartIconPanelContainer);
        break;
    case RIGHT:
        chartIconPanelContainer = new VerticalPanel();
        setLayout(new ColumnLayout());
        add(graphPanelContainer, new ColumnData(.95));
        add(chartIconPanelContainer, new ColumnData(0.05));
        break;
    default:

    }

    chartIconPanelContainer.add(columnChartIcon);
    chartIconPanelContainer.add(pieChartIcon);
    chartIconPanelContainer.add(lineChartIcon);

    layout();
}