Example usage for com.google.gwt.visualization.client.visualizations PieChart PACKAGE

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

Introduction

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

Prototype

String PACKAGE

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

Click Source Link

Usage

From source file:com.google.speedtracer.latencydashboard.client.MarkTimelineLatencyDashboard.java

License:Apache License

private void createDashboardUi() {
    refreshButton.getElement().getStyle().setMarginLeft(3, Unit.EM);
    refreshButton.setEnabled(false);//from   w  w  w  .  j ava  2 s . c o m
    refreshButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            populateDashboard();
        }
    });

    VisualizationUtils.loadVisualizationApi(new Runnable() {
        /**
         * Load data from the server.
         */
        public void run() {
            refreshButton.setEnabled(true);
            createCharts();
            populateDashboard();
            RootPanel.get().add(refreshButton);
            Window.addResizeHandler(new ResizeHandler() {

                public void onResize(ResizeEvent event) {
                    populateDashboard();
                }

            });
        }
    }, AreaChart.PACKAGE, LineChart.PACKAGE, PieChart.PACKAGE, Gauge.PACKAGE);
}

From source file:com.radoslavhusar.tapas.war.client.app.VisualizationDemo.java

License:Apache License

public void onModuleLoad() {
    VisualizationUtils.loadVisualizationApi(new Runnable() {

        public void run() {
            final VerticalPanel vp = new VerticalPanel();
            vp.getElement().getStyle().setPropertyPx("margin", 15);
            RootPanel.get().add(vp);/*from   ww w. jav  a  2  s  .  co  m*/
            vp.add(new Label("Google Visualization with GWT demo."));
            vp.add(tabPanel);
            tabPanel.setWidth("800");
            tabPanel.setHeight("600");
            tabPanel.add(createPieChart(), "Pie Chart");
            tabPanel.add(createTable(), "Table");
            tabPanel.add(createDataView(), "DataView");
            tabPanel.selectTab(0);
        }
    }, PieChart.PACKAGE, Table.PACKAGE);
}

From source file:cz.mzk.editor.client.view.other.UserStatisticsLayout.java

License:Open Source License

private void showChartAndTable(final String[] intervalsOrNames, final Integer[] values,
        final HashMap<String, Integer[]> userValues, final boolean showCharts) {

    final Runnable runnable = new Runnable() {

        @Override/*from w ww  .  j a v  a2s .  c  o  m*/
        public void run() {

            if (showCharts) {
                int pieIndex = chartsLayout.getMemberNumber(htmlPieFlow);
                htmlPieFlow.removeFromParent();
                if (pieIndex < 0) {
                    chartsLayout.addMember(htmlPieFlow);
                } else {
                    chartsLayout.addMember(htmlPieFlow, pieIndex);
                }

                int index = chartsLayout.getMemberNumber(htmlLineFlow);
                htmlLineFlow.removeFromParent();
                if (index < 0) {
                    chartsLayout.addMember(htmlLineFlow);
                } else {
                    chartsLayout.addMember(htmlLineFlow, index);
                }
            } else {
                removeMember(chartsLayout);
            }

            setWidth100();

            if (userValues == null) {
                if (showCharts) {
                    ChartUtils.drawPieChart(JSOHelper.convertToJavaScriptArray(intervalsOrNames),
                            JSOHelper.convertToJavaScriptArray(values), values.length,
                            PIE_CHART_NESTED_DIV_ID + userId,
                            (int) (UserStatisticsLayout.this.getWidth() * PIE_SIZE_CONVERSION));

                    ChartUtils.drawLineChart(JSOHelper.convertToJavaScriptArray(intervalsOrNames),
                            JSOHelper.convertToJavaScriptArray(values), values.length,
                            LINE_CHART_NESTED_DIV_ID + userId,
                            (int) (UserStatisticsLayout.this.getWidth() * LINE_BAR_SIZE_CONVERSION));
                } else {
                    setHeight(100);
                    redraw();
                }
                HashMap<String, Integer[]> userVal = new HashMap<String, Integer[]>();
                userVal.put(userName, values);
                if (table == null) {
                    table = new TableListGrid(intervalsOrNames, userVal);
                    addMember(table);
                }
            } else {
                drawUnifyingChartsAndTables(intervalsOrNames, userValues, showCharts);
            }
        }
    };

    VisualizationUtils.loadVisualizationApi(runnable, PieChart.PACKAGE);

    Window.addResizeHandler(new ResizeHandler() {

        @Override
        public void onResize(ResizeEvent event) {
            com.google.gwt.user.client.Timer timer = new com.google.gwt.user.client.Timer() {

                @Override
                public void run() {
                    VisualizationUtils.loadVisualizationApi(runnable,
                            com.google.gwt.visualization.client.visualizations.PieChart.PACKAGE);
                }
            };
            timer.schedule(1);
        }
    });
}

From source file:de.uni_koeln.spinfo.maalr.webapp.ui.admin.client.general.DbManager.java

License:Apache License

private void initVisualization() {
    service.getSystemSummary(new AsyncCallback<SystemSummary>() {

        @Override/*  w w w.  j av  a 2 s. c  om*/
        public void onFailure(Throwable caught) {
            hideSystemSummary();
        }

        @Override
        public void onSuccess(SystemSummary result) {
            if (result == null) {
                hideSystemSummary();
            } else {
                // Create a callback to be called when the visualization API
                // has been loaded.
                Runnable onLoadCallback = new Runnable() {
                    public void run() {
                        initializeCharts();
                    }

                };
                // Load the visualization api, passing the onLoadCallback to be called
                // when loading is done.
                VisualizationUtils.loadVisualizationApi(onLoadCallback, PieChart.PACKAGE, Gauge.PACKAGE,
                        BarChart.PACKAGE);
            }
        }

        private void hideSystemSummary() {
            chartsColumn.setVisible(false);
            settingsColumn.setSize(12);
        }
    });
}