Package org.jfree.data.general

Examples of org.jfree.data.general.DefaultPieDataset


   *
   * @return A sample dataset.
   */
  private PieDataset createSampleDataset()
  {
    final DefaultPieDataset result = new DefaultPieDataset();
    // cheating: java has a higher chance to be the best language :)
    result.setValue("Java", new Integer((int) (Math.random() * 200)));
    result.setValue("Visual Basic", new Integer((int) (Math.random() * 50)));
    result.setValue("C/C++", new Integer((int) (Math.random() * 100)));
    result.setValue("PHP", new Integer((int) (Math.random() * 50)));
    result.setValue("Perl", new Integer((int) (Math.random() * 100)));
    return result;

  }
View Full Code Here


   *
   * @return A sample dataset.
   */
  private PieDataset createSampleDataset()
  {
    final DefaultPieDataset result = new DefaultPieDataset();
    // cheating: java has a higher chance to be the best language :)
    result.setValue("Java", new Integer((int) (Math.random() * 200)));
    result.setValue("Visual Basic", new Integer((int) (Math.random() * 50)));
    result.setValue("C/C++", new Integer((int) (Math.random() * 100)));
    result.setValue("PHP", new Integer((int) (Math.random() * 50)));
    result.setValue("Perl", new Integer((int) (Math.random() * 100)));
    return result;

  }
View Full Code Here

    {
      pieDataset = null;
      results.clear();
      if (getResetGroup() == null)
      {
        pieDataset = new DefaultPieDataset();
        results.add(pieDataset);
      }
    }
    else
    {
View Full Code Here

      if (FunctionUtilities.isDefinedGroup(getResetGroup(), event))
      {
        // reset ...
        if (FunctionUtilities.isDefinedPrepareRunLevel(this, event))
        {
          pieDataset = new DefaultPieDataset();
          results.add(pieDataset);
        }
        else
        {
          if (FunctionUtilities.isLayoutLevel(event))
View Full Code Here

      // we do not modify the created dataset if this is not the function
      // computation run. (FunctionLevel '0')
      return;
    }

    final DefaultPieDataset localPieDataset = pieDataset;

    if (!isSummaryOnly())
    {
      final Object seriesObject = getDataRow().get(getSeriesColumn());
      final Comparable seriesComparable;
      if (seriesObject instanceof Comparable)
      {
        seriesComparable = (Comparable) seriesObject;
      }
      else
      {
        // ok, we need some better error management here. Its a
        // prototype :)
        seriesComparable = "PIESETCOLL.USER_ERROR_CATEGORY_NOT_COMPARABLE"; //$NON-NLS-1$
      }
      final Object valueObject = getDataRow().get(getValueColumn());

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

      Object isThere = null;
      try
      {
        isThere = localPieDataset.getValue(seriesComparable);
      }
      catch (Exception ignored)
      {
      }
      if (isThere != null)
      {
        final double val = (value != null) ? value.doubleValue() : 0;
        value = new Double(val + ((Number) isThere).doubleValue());
      }

      localPieDataset.setValue(seriesComparable, value);

    }
  }
View Full Code Here

      // we do not modify the created dataset if this is not the function
      // computation run. (FunctionLevel '0')
      return;
    }

    final DefaultPieDataset localPieDataset = pieDataset;

    if (isSummaryOnly())
    {
      if (FunctionUtilities.isDefinedGroup(getGroup(), reportEvent))
      {
        // we can be sure that everything has been computed here. So
        // grab the
        // values and add them to the dataset.
        final Object seriesObject = getDataRow().get(getSeriesColumn());
        final Comparable seriesComparable;
        if (seriesObject instanceof Comparable)
        {
          seriesComparable = (Comparable) seriesObject;
        }
        else
        {
          // ok, we need some better error management here. Its a
          // prototype :)
          seriesComparable = ("PIESETCOLL.USER_ERROR_SERIES_NOT_COMPARABLE"); //$NON-NLS-1$
        }
        final Object valueObject = getDataRow().get(getValueColumn());

        final Number value = (valueObject instanceof Number) ? (Number) valueObject : null;
        localPieDataset.setValue(seriesComparable, value);
      }
    }
  }
View Full Code Here

    this.valueColumn = valueColumn;
  }

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

    return new DefaultPieDataset();
  }

  protected void buildDataset()
  {
    final DefaultPieDataset localPieDataset = (DefaultPieDataset) getDataSet();
    final Comparable seriesComparable = querySeriesValue(0);
    if (seriesComparable == null)
    {
      return;
    }

    final Object valueObject = getDataRow().get(getValueColumn());
    final Number value = (valueObject instanceof Number) ? (Number) valueObject : null;
    final Number existingValue = CollectorFunctionUtil.queryExistingValueFromDataSet(localPieDataset, seriesComparable);
    if (existingValue != null)
    {
      if (value != null)
      {
        localPieDataset.setValue(seriesComparable, CollectorFunctionUtil.add(existingValue, value));
      }
    }
    else
    {
      localPieDataset.setValue(seriesComparable, value);
    }
  }
View Full Code Here

import de.sub.goobi.beans.Schritt;

public class StatistikBenutzergruppen {

  public static Dataset getDiagramm(List<Prozess> inProzesse) {
    DefaultPieDataset dataset = new DefaultPieDataset();
    for (Prozess proz : inProzesse) {
      Schritt step = proz.getAktuellerSchritt();
      /* wenn wirklich ein aktueller Schritt zurückgegeben wurde */
      if (step != null) {
        /* von dem Schritt alle verantwortlichen Benutzergruppen ermitteln und im Diagramm erfassen */
        for (Iterator<Benutzergruppe> iter2 = step.getBenutzergruppenList().iterator(); iter2.hasNext();) {
          Benutzergruppe group = iter2.next();
          if (dataset.getIndex(group.getTitel()) != -1) {
            dataset
                .setValue(group.getTitel(), dataset.getValue(group.getTitel()).intValue() + 1);
          } else {
            dataset.setValue(group.getTitel(), 1);
          }
        }

      }
    }
View Full Code Here

public class StatistikStatus {

  @SuppressWarnings({ "unchecked", "rawtypes" })
  public static Dataset getDiagramm(List inProzesse) {
    DefaultPieDataset dataset = new DefaultPieDataset();
    for (Prozess proz : (List<Prozess>) inProzesse) {
      Schritt step = proz.getAktuellerSchritt();
      /* wenn wirklich ein aktueller Schritt zurückgegeben wurde */
      if (step != null) {
        /* prüfen, ob der Schritt schon erfasst wurde, wenn ja hochzählen */
        String kurztitel = (step.getTitel().length() > 60 ? step.getTitel().substring(0, 60) + "..." : step
          .getTitel());
        if (dataset.getIndex(kurztitel) != -1) {
          dataset.setValue(kurztitel, dataset.getValue(kurztitel).intValue() + 1);
        } else {
          dataset.setValue(kurztitel, 1);
        }
      }
    }
    return dataset;
  }
View Full Code Here

TOP

Related Classes of org.jfree.data.general.DefaultPieDataset

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.