Example usage for com.google.gwt.graphics.client.charts PieChart PieChart

List of usage examples for com.google.gwt.graphics.client.charts PieChart PieChart

Introduction

In this page you can find the example usage for com.google.gwt.graphics.client.charts PieChart PieChart.

Prototype

public PieChart(Widget parent, List<ColorCodedValue> data, PieChart.Resources resources) 

Source Link

Usage

From source file:com.google.speedtracer.client.visualizations.view.EventWaterfallRowDetails.java

License:Apache License

private PieChart createPieChart(Container parent) {
    ensureData();//from  w w  w.ja v a 2  s  .c om
    // We put an extra div in there to center our piechart and to apply
    // the rounded corners and backing layer styles underneath the piechart.
    Div centeringDiv = new Div(parent);
    centeringDiv.addStyleName(getCss().pieChartContainer());
    PieChart chart = new PieChart(centeringDiv, data, resources);
    chart.showLegend();

    return chart;
}

From source file:com.google.speedtracer.client.visualizations.view.ReportDialog.java

License:Apache License

private void constructReportUi(Resources resources) {
    Css css = resources.hintletReportDialogCss();
    Container reportPaneContainer = new DefaultContainerImpl(reportPane.getElement());

    // Create a container for the summary information.
    Div summaryInfoDiv = new Div(reportPaneContainer);
    summaryInfoDiv.setStyleName(css.reportPaneInner());
    Container summaryInfoContainer = new DefaultContainerImpl(summaryInfoDiv.getElement());

    // Create the title for the summary information.
    summaryTitle = summaryInfoDiv.getElement().getOwnerDocument().createDivElement();
    summaryTitle.setClassName(css.reportTitle());
    updateSummaryTitle();/*from  w w w.j  a v a2 s .com*/
    summaryInfoDiv.getElement().appendChild(summaryTitle);

    // Summary info is a 2 column section. PieChart on the left, and the startup
    // statistics on the right.
    Table summaryLayout = new Table(summaryInfoContainer);
    summaryLayout.setFixedLayout(true);
    TableRowElement row = summaryLayout.insertRow(-1);
    row.setVAlign("top");
    TableCellElement leftCell = row.insertCell(-1);
    Container pieChartContainer = new DefaultContainerImpl(leftCell);

    // Create a piechart with no data initially.
    this.pieChart = new PieChart(pieChartContainer, new ArrayList<ColorCodedValue>(), resources);

    // TODO (jaimeyap): Add startup statistics to the right of the pie chart.
    // Things like "time to first paint" or "page load time".

    // Create the inner container to hold to hint report.
    Div hintReportDiv = new Div(reportPaneContainer);
    hintReportDiv.setStyleName(css.reportPaneInner());
    Container hintReportContainer = new DefaultContainerImpl(hintReportDiv.getElement());

    // Create the title for the hint report.
    DivElement hintTitle = hintReportDiv.getElement().getOwnerDocument().createDivElement();
    hintTitle.setInnerText("Hints");
    hintTitle.setClassName(css.reportTitle());
    hintReportDiv.getElement().appendChild(hintTitle);

    // Construct the scope bar for selecting different type of hint reports.
    buildHintReportScopeBar(resources, hintReportContainer);

    // Create the hint report.
    this.report = new HintletReport(hintReportContainer, new HintletReportModel(), resources,
            HintletReport.REPORT_TYPE_SEVERITY);
}