Example usage for com.google.gwt.visualization.client DataTable getValueDouble

List of usage examples for com.google.gwt.visualization.client DataTable getValueDouble

Introduction

In this page you can find the example usage for com.google.gwt.visualization.client DataTable getValueDouble.

Prototype

public final native double getValueDouble(int rowIndex, int columnIndex) ;

Source Link

Usage

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

License:Apache License

public void draw(DataTable data, Options options) {
    if (options == null) {
        options = createOptions();//from ww w .ja va  2s . c o m
    }

    // If a datapoint is 0, then it won't consume a color which causes the chart
    // and the legend to get out of sync, so we need to remove the corresponding
    // color before drawing.
    int numRemoved = 0;
    for (int i = 0, n = data.getNumberOfRows(); i < n; i++) {
        if (data.getValueDouble(i, 1) == 0) {
            legendColors.remove(i - numRemoved++);
        }
    }
    String[] colors = new String[legendColors.size()];
    options.setColors(legendColors.toArray(colors));
    pieChart.draw(data, options);
}