コード例 #1
0
  private void setDataByRow(final IPentahoResultSet data) {
    // TODO Make this routine MDX friendly
    if (data == null) {
      noDataMessage =
          Messages.getInstance().getString("CHART.USER_NO_DATA_AVAILABLE"); // $NON-NLS-1$
      return; // No data so we've got nothing to set
      // TODO come up with some sort of error strategy here.
    }
    Class timePeriodClass =
        TimeSeriesCollectionChartDefinition.getTimePeriodClass(getDomainPeriodType());
    Object[] rowData = data.next();
    while (rowData != null) {
      String seriesName = (String) rowData[0];
      TimeSeries wrkSeries = new TimeSeries(seriesName, timePeriodClass);
      for (int column = 1; column < rowData.length - 1; column = column + 2) {
        Date keyDate = getValidDate(rowData[column]);
        TimeSeriesDataItem timeSeriesDataItem =
            new TimeSeriesDataItem(
                RegularTimePeriod.createInstance(
                    timePeriodClass, keyDate, RegularTimePeriod.DEFAULT_TIME_ZONE),
                ((Number) rowData[column + 1]).doubleValue());
        wrkSeries.add(timeSeriesDataItem);
      }
      addSeries(wrkSeries);
      rowData = data.next();
    }

    if ((data.getRowCount() > 0) && (this.getSeriesCount() <= 0)) {
      noDataMessage =
          Messages.getInstance().getString("CHART.USER_INCORRECT_DATA_FORMAT"); // $NON-NLS-1$
    }
  }
コード例 #2
0
 private void setDataByColumn(final IPentahoResultSet data) {
   // TODO Make this routine MDX friendly
   if (data == null) {
     noDataMessage =
         Messages.getInstance().getString("CHART.USER_NO_DATA_AVAILABLE"); // $NON-NLS-1$
     return; // No data so we've got nothing to set
     // TODO come up with some sort of error strategy here.
   }
   boolean firstPass = true;
   String lastSeries = ""; // $NON-NLS-1$
   String seriesName = ""; // $NON-NLS-1$
   Class timePeriodClass =
       TimeSeriesCollectionChartDefinition.getTimePeriodClass(getDomainPeriodType());
   Object[] rowData = data.next();
   TimeSeries wrkSeries = null;
   while (rowData != null) {
     seriesName = (String) rowData[0];
     if (firstPass || !seriesName.equalsIgnoreCase(lastSeries)) {
       if (!firstPass) {
         addSeries(wrkSeries);
       }
       wrkSeries = new TimeSeries(seriesName, timePeriodClass);
       lastSeries = seriesName;
       firstPass = false;
     }
     Date keyDate = getValidDate(rowData[1]);
     RegularTimePeriod regularTimePeriod =
         RegularTimePeriod.createInstance(
             timePeriodClass, keyDate, RegularTimePeriod.DEFAULT_TIME_ZONE);
     TimeSeriesDataItem timeSeriesDataItem =
         new TimeSeriesDataItem(regularTimePeriod, ((Number) rowData[2]).doubleValue());
     if (wrkSeries != null) {
       wrkSeries.add(timeSeriesDataItem);
     }
     rowData = data.next();
   }
   if (!firstPass) {
     addSeries(wrkSeries);
   }
   if ((data.getRowCount() > 0) && (this.getSeriesCount() <= 0)) {
     noDataMessage =
         Messages.getInstance().getString("CHART.USER_INCORRECT_DATA_FORMAT"); // $NON-NLS-1$
   }
 }