Package org.jfree.data.category

Examples of org.jfree.data.category.DefaultCategoryDataset


    buildDataset();
  }

  protected void buildDataset()
  {
    final DefaultCategoryDataset categoryDataset = (DefaultCategoryDataset) getDatasourceValue();
    if (isGeneratedReport())
    {
      buildAutoGeneratedDataSet(categoryDataset);
      return;
    }

    final DataRow dataRow = getDataRow();
    final Object categoryObject = dataRow.get(getCategoryColumn());
    final Comparable categoryComparable;
    if (categoryObject instanceof Comparable)
    {
      categoryComparable = (Comparable) categoryObject;
    }
    else
    {
      // ok, we need some better error management here. Its a
      // prototype :)
      categoryComparable = ("CATEGORYSETCOLL.USER_ERROR_CATEGORY_NOT_COMPARABLE"); //$NON-NLS-1$
    }

    // I love to be paranoid!
    final String[] seriesNames = getSeriesName();
    final int maxIndex = Math.min(seriesNames.length, this.valueColumns.size());
    for (int i = 0; i < maxIndex; i++)
    {
      String seriesName = seriesNames[i];
      final String column = (String) valueColumns.get(i);
      final Object valueObject = dataRow.get(column);
      if (isSeriesColumn())
      {
        final Object tmp = dataRow.get(seriesName);
        if (tmp != null)
        {
          seriesName = tmp.toString();
        }
      }

      final Number value = (valueObject instanceof Number) ? (Number) valueObject : null;

      final Number existingValue = queryExistingValueFromDataSet(categoryDataset, seriesName, categoryComparable);
      if (existingValue != null)
      {
        if (value != null)
        {
          final double val = value.doubleValue();
          categoryDataset.addValue(new Double(val + existingValue.doubleValue()), seriesName, categoryComparable);
        }
      }
      else
      {
        categoryDataset.addValue(value, seriesName, categoryComparable);
      }
    }
  }
View Full Code Here


  }


  protected Dataset createNewDataset()
  {
    return new DefaultCategoryDataset();
  }
View Full Code Here

    }

    final Comparable categoryComparable = (Comparable) categoryObject;

    // I love to be paranoid!
    final DefaultCategoryDataset categoryDataset = (DefaultCategoryDataset) getDataSet();

    final int maxIndex = this.valueColumns.size();
    for (int i = 0; i < maxIndex; i++)
    {
      final Comparable seriesName = querySeriesValue(i);
      final Object valueObject = dataRow.get(getValueColumn(i));
      final Number value = (valueObject instanceof Number) ? (Number) valueObject : null;
      final Number existingValue = CollectorFunctionUtil.queryExistingValueFromDataSet(categoryDataset, categoryComparable, seriesName);
      if (existingValue != null)
      {
        if (value != null)
        {
          categoryDataset.setValue(CollectorFunctionUtil.add(existingValue, value), categoryComparable, seriesName);
        }
      }
      else
      {
        categoryDataset.setValue(value, categoryComparable, seriesName);
      }
    }
  }
View Full Code Here

  protected JFreeChart computeChart(final Dataset dataset)
  {

    //Initializing a default CategoryDataset
    DefaultCategoryDataset defaultDataset = new DefaultCategoryDataset();

    if (dataset instanceof DefaultCategoryDataset)
    {
      defaultDataset = (DefaultCategoryDataset) dataset;
    }
View Full Code Here

    this.valueColumns.addAll(Arrays.asList(fields));
  }

  protected Dataset createNewDataset()
  {
    return new DefaultCategoryDataset();
  }
View Full Code Here

    }

    final Comparable categoryComparable = (Comparable) categoryObject;

    // I love to be paranoid!
    final DefaultCategoryDataset categoryDataset = (DefaultCategoryDataset) getDataSet();

    final int maxIndex = this.valueColumns.size();
    for (int i = 0; i < maxIndex; i++)
    {
      final Comparable seriesName = querySeriesValue(i);
      if (seriesName == null)
      {
        continue;
      }
      final Object valueObject = dataRow.get(getValueColumn(i));

      final Number value = (valueObject instanceof Number) ? (Number) valueObject : null;

      final Number existingValue =
          CollectorFunctionUtil.queryExistingValueFromDataSet(categoryDataset, seriesName, categoryComparable);
      if (existingValue != null)
      {
        if (value != null)
        {
          categoryDataset.setValue(CollectorFunctionUtil.add(existingValue, value), seriesName, categoryComparable);
        }
      }
      else
      {
        categoryDataset.setValue(value, seriesName, categoryComparable);
      }
    }
  }
View Full Code Here

    this.categoryNames.addAll(Arrays.asList(fields));
  }

  protected void buildDataset()
  {
    final DefaultCategoryDataset dataset = (DefaultCategoryDataset) getDatasourceValue();

    //get value in column that identifies the rows       
    final Object currentRowHeader = getDataRow().get(seriesColumnHeader);

    //Check if row is part of the graph series
    final int catCount = getCategoryNameCount();
    final int seriesNameCount = getSeriesNameCount();

    for (int i = 0; i < seriesNameCount; i++)
    {
      final String seriesName = getSeriesName(i);
      if (ObjectUtilities.equal(seriesName, currentRowHeader) == false)
      {
        // filters out all series except the one marked as seriesColumnHeader.
        continue;
      }

      for (int j = 0; j < catCount; j++)
      {

        final String newRowHeader = getCategoryName(j);

        //if not rowHeader Column
        if (ObjectUtilities.equal(newRowHeader, seriesColumnHeader))
        {
          continue;
        }

        final Object valueObject = getDataRow().get(newRowHeader);
        Number value = (valueObject instanceof Number) ? (Number) valueObject : null;
        final Number existingValue = queryExistingValueFromDataSet(dataset, seriesName, newRowHeader);

        if (existingValue != null)
        {
          final double val = (value != null) ? value.doubleValue() : 0;
          value = new Double(val + existingValue.doubleValue());
          dataset.setValue(value, seriesName, newRowHeader);
        }
        else
        {
          dataset.addValue(value, seriesName, newRowHeader);
        }
      }
    }
  }
View Full Code Here

public class StatistikLaufzeitSchritte {

  @SuppressWarnings({ "unchecked", "rawtypes" })
  public static Dataset getDiagramm( List inProzesse) {
    DefaultCategoryDataset categoryDataSet = new DefaultCategoryDataset();
    for (Prozess proz : (List<Prozess>) inProzesse) {
      for (Schritt step : proz.getSchritteList()) {
        /* wenn Anfangs- und Enddatum vorhanden sind, diese auswerten */
        if (step.getBearbeitungsbeginn() != null && step.getBearbeitungsende() != null) {
          String kurztitel = (step.getTitel().length() > 60 ? step.getTitel().substring(0, 60) + "..." : step
            .getTitel());
          categoryDataSet.addValue(dateDifference(step.getBearbeitungsbeginn(), step.getBearbeitungsende()),
            kurztitel, proz.getTitel());
        }
      }
    }
    return categoryDataSet;
View Full Code Here

    {
        String title = chartingDefinition.getChartTitle();
        String xAxisTitle = chartingDefinition.getXAxisTitle();
        String yAxisTitle = chartingDefinition.getYAxisTitle();

        final DefaultCategoryDataset dataset = new DefaultCategoryDataset();

        _seriesBuilder.setSeriesBuilderCallback(new SeriesBuilderCallback()
        {
            @Override
            public void addDataPointToSeries(SeriesDefinition seriesDefinition, Object[] row)
            {
                String x = String.valueOf(row[0]);
                double y = Double.parseDouble(row[1].toString());
                dataset.addValue( y, seriesDefinition.getSeriesLegend(), x);
            }

            @Override
            public void beginSeries(SeriesDefinition seriesDefinition)
            {
View Full Code Here

    final String category1 = "Category 1";// NON-NLS
    final String category2 = "Category 2";// NON-NLS
    final String category3 = "Category 3";// NON-NLS
    final String category4 = "Category 4";// NON-NLS
    final String category5 = "Category 5";// NON-NLS
    final DefaultCategoryDataset dataset = new DefaultCategoryDataset();

    dataset.addValue(1D, series1, category1);
    dataset.addValue(5D, series1, category2);
    dataset.addValue(4D, series1, category3);
    dataset.addValue(8D, series1, category4);
    dataset.addValue(7D, series1, category5);

    dataset.addValue(3D, series2, category1);
    dataset.addValue(4D, series2, category2);
    dataset.addValue(3D, series2, category3);
    dataset.addValue(5D, series2, category4);
    dataset.addValue(4D, series2, category5);

    dataset.addValue(1D, series3, category1);
    dataset.addValue(3D, series3, category2);
    dataset.addValue(2D, series3, category3);
    dataset.addValue(3D, series3, category4);
    dataset.addValue(2D, series3, category5);

    return dataset;
  }
View Full Code Here

TOP

Related Classes of org.jfree.data.category.DefaultCategoryDataset

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.