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

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

Introduction

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

Prototype

public ColorCodedValue(String key, double value, Color labelColor) 

Source Link

Usage

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

License:Apache License

private void ensureData() {
    if (data == null) {
        data = new ArrayList<ColorCodedValue>();
        UiEvent event = getParentRow().getEvent();
        JsIntegerDoubleMap durations = event.getTypeDurations();

        assert (durations != null);

        durations.iterate(new JsIntegerDoubleMap.IterationCallBack() {
            public void onIteration(int key, double val) {
                if (val > 0) {
                    data.add(new ColorCodedValue(
                            EventRecord.typeToString(key) + " (" + TimeStampFormatter.format(val) + ")", val,
                            EventRecordColors.getColorForType(key)));
                }/*  w  w  w  .j a v a 2  s. co m*/
            }
        });
        Collections.sort(data);
    }
}

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

License:Apache License

private void populatePieChart(JsIntegerDoubleMap aggregateTypeDurations) {
    final List<ColorCodedValue> data = new ArrayList<ColorCodedValue>();

    assert (aggregateTypeDurations != null);

    // Flatten the aggregate map into a sorted list.
    aggregateTypeDurations.iterate(new JsIntegerDoubleMap.IterationCallBack() {
        public void onIteration(int key, double val) {
            if (val > 0) {
                String typeName = (key == -1) ? "UI Thread Available" : EventRecord.typeToString(key);
                typeName += " (" + TimeStampFormatter.format(val) + ")";
                data.add(new ColorCodedValue(typeName, val, EventRecordColors.getColorForType(key)));
            }//  w w  w .  ja  va2 s.com
        }
    });

    Collections.sort(data);
    // Update the piechart with this data.
    this.pieChart.setData(data);
    this.pieChart.render();
    this.pieChart.showLegend();
}