Package com.google.gwt.visualization.client

Examples of com.google.gwt.visualization.client.DataTable


    options.setTitle("Annually Opportunity Volumes");
    return options;
  }

  private AbstractDataTable getAbstractTable(Map<Integer, Double> result) {
    DataTable data = DataTable.create();
    data.addColumn(ColumnType.STRING, "Year");
    data.addColumn(ColumnType.NUMBER, "Annually Volume");

    data.addRows(result.keySet().size());

    int i = 0;
    for (final Integer year : result.keySet()) {
      data.setValue(i, 0, String.valueOf(year));
      data.setValue(i, 1, result.get(year));
      i++;
    }

    return data;
  }
View Full Code Here


    options.setTitle(report.getTitle());
    return options;
  }

  private AbstractDataTable getAbstractTable(final ReportData<Map<Integer, Map<String, Integer>>> report, final ReportMetaData reportMeta) {
    DataTable data = DataTable.create();
    data.addColumn(ColumnType.STRING, "Year"); // TODO generalize

    for (final String column : reportMeta.getColumns()) {
      data.addColumn(ColumnType.NUMBER, column);
    }

    data.addRows(report.getValues().size());

    int i = 0;
    for (final Map.Entry<Integer, Map<String, Integer>> entry : report.getValues().entrySet()) {
      data.setValue(i, 0, String.valueOf(entry.getKey()));

      final Map<String, Integer> annualValues = entry.getValue();
      final ArrayList<String> sortedKeys = new ArrayList<String>(annualValues.keySet());
      Collections.sort(sortedKeys);

      int column = 1;
      for (final String key : sortedKeys) {
        data.setValue(i, column++, entry.getValue().get(key));
      }

      i++;
    }
View Full Code Here

  }

  private AbstractDataTable getAbstractTable(final double factor) {
    Map<Integer, Double> result = getSampleData();

    DataTable data = DataTable.create();

    data.addColumn(ColumnType.NUMBER, "Real revenue created by foo");
    data.addColumn(ColumnType.NUMBER, "Real overall revenue");
    data.addColumn(ColumnType.NUMBER, "Real overall expenses");
    data.addColumn(ColumnType.NUMBER, "Simulated Revenue for foo");
    data.addColumn(ColumnType.NUMBER, "Simulated overall revenue");
    // data.addColumn(ColumnType.NUMBER, "Similated additional revenue");

    data.addRows(result.keySet().size());

    int row = 0;
    for (final Integer x : result.keySet()) {
      int col = 0;
      final double realRevenue = overallRevenue.get(x) - realExpenses.get(x);
      final double realRevenueFromFoo = Math.floor(result.get(x));
      final double simulatedRevenueFromFoo = factor * realRevenueFromFoo;
      final double additionalRevenue = simulatedRevenueFromFoo - realRevenueFromFoo;

      data.setValue(row, col++, realRevenueFromFoo);
      data.setValue(row, col++, realRevenue);
      data.setValue(row, col++, realExpenses.get(x));
      data.setValue(row, col++, simulatedRevenueFromFoo);
      data.setValue(row, col++, realRevenue + additionalRevenue);
      // data.setValue(row, col++, additionalRevenue);

      row++;
    }

View Full Code Here

    options.setTitle(title);
    return options;
  }

  private AbstractDataTable getDataTableCalls(final Collection<ServiceCallStatistics> result) {
    final DataTable table = DataTable.create();

    table.addColumn(ColumnType.STRING, "Service");
    table.addColumn(ColumnType.NUMBER, "#Calls");
    table.addRows(result.size());

    int y = 0;
    for (final ServiceCallStatistics stats : result) {
      table.setValue(y, 0, stats.getServiceName());
      table.setValue(y, 1, stats.getCalls());
      y++;
    }

    return table;
  }
View Full Code Here

    return table;
  }

  private AbstractDataTable getDataTableAvg(final Collection<ServiceCallStatistics> result) {
    final DataTable table = DataTable.create();

    table.addColumn(ColumnType.STRING, "Service");
    table.addColumn(ColumnType.NUMBER, "Avg");
    table.addRows(result.size());

    int y = 0;
    for (final ServiceCallStatistics stats : result) {
      table.setValue(y, 0, stats.getServiceName());
      table.setValue(y, 1, stats.getExecutionTimeAvg());
      y++;
    }

    return table;
  }
View Full Code Here

      options.setTitle(title);
      return options;
  }
 
  private static AbstractDataTable createCPUTable(LinkedList<long[]> cpuTimes) {
      DataTable data = DataTable.create();
      data.addColumn(ColumnType.NUMBER, "CPU Times (millis)");
      data.addColumn(ColumnType.NUMBER, "User Times (millis)");
      int size = cpuTimes.size();
      data.addRows(size);
      int idx = 0;
     
      for (long[] cpuTime : cpuTimes){
        long cpuInMillis = cpuTime[0]/1000000;
        long userInMillis = cpuTime[1]/1000000;
        data.setValue(idx, 0, cpuInMillis);
        data.setValue(idx, 1, userInMillis);
        idx++;
      }
      return data;
  }
View Full Code Here

      }
      return data;
  }
 
  private static AbstractDataTable createMemTable(RuntimeSystemInfo sysInfo) {
      DataTable data = DataTable.create();
      data.addColumn(ColumnType.STRING, "Memory Usage");
      data.addColumn(ColumnType.NUMBER, "Percentage");
      data.addRows(2);
      data.setValue(0, 0, "Free");
      data.setValue(0, 1, sysInfo==null ? 0 : sysInfo.getFreeMemory());
      data.setValue(1, 0, "Used");
      data.setValue(1, 1, sysInfo==null ? 0 : sysInfo.getMaxMemory() - sysInfo.getFreeMemory());
      return data;
  }
View Full Code Here

          public void onResponse(QueryResponse response) {
            if (response.isError()) {
              display.chartArea().add(new Label(response.getMessage()));
            } else {
              // Get the data from the QueryResponse.
              DataTable data = response.getDataTable();

              // Create the Options object.
              Options options = Options.create();
              options.setDisplayAnnotations(true);
              options.setWindowMode(WindowMode.TRANSPARENT);
View Full Code Here

          public void onResponse(QueryResponse response) {
            if (response.isError()) {
              display.chartArea().add(new Label(response.getMessage()));
            } else {
              // Get the data from the QueryResponse.
              DataTable data = response.getDataTable();

              // Create the Options object.

              int width = StatisticsPresenter.this.display.chartAreaWidth() / 2;
              com.google.gwt.visualization.client.visualizations.LineChart.Options options = com.google.gwt.visualization.client.visualizations.LineChart.Options.create();
View Full Code Here

          public void onResponse(QueryResponse response) {
            if (response.isError()) {
              display.chartArea().add(new Label(response.getMessage()));
            } else {
              // Get the data from the QueryResponse.
              DataTable data = response.getDataTable();

              // Create the Options object.
              // PieChart.PieOptions options =
              // PieChart.createPieOptions();
              // options.set3D(true);
View Full Code Here

TOP

Related Classes of com.google.gwt.visualization.client.DataTable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.