Package org.jfree.data.general

Examples of org.jfree.data.general.PieDataset


  }

  protected JFreeChart computeChart(final Dataset dataset)
  {

    PieDataset pieDataset = null;
    if (dataset instanceof PieDataset)
    {
      pieDataset = (PieDataset) dataset;
    }
View Full Code Here


  }


  protected void configureExplode(final PiePlot pp)
  {
    final PieDataset pieDS = pp.getDataset();

    final int explodeType = computeExplodeType();
    if (explodeType == EXPLODE_VALUE)
    {
      try
      {
        final int actualSegment = Integer.parseInt(explodeSegment);
        if (actualSegment >= 0)
        {
          pp.setExplodePercent(pieDS.getKey(actualSegment), explodePct.doubleValue());
        }
      }
      catch (Exception ignored)
      {
      }
      return;
    }

    // Calculate min and max...
    if (pieDS != null)
    {
      final int itemCount = pieDS.getItemCount();
      Number maxNum = new Double(Integer.MIN_VALUE);
      Number minNum = new Double(Integer.MAX_VALUE);
      int maxSegment = -1;
      int minSegment = -1;
      for (int i = 0; i < itemCount; i++)
      {
        final Number nbr = pieDS.getValue(i);
        if (nbr.doubleValue() > maxNum.doubleValue())
        {
          maxNum = nbr;
          maxSegment = i;
        }
        if (nbr.doubleValue() < minNum.doubleValue())
        {
          minNum = nbr;
          minSegment = i;
        }
      }

      if (explodeType == EXPLODE_MIN)
      { //$NON-NLS-1$
        if (minSegment >= 0)
        {
          pp.setExplodePercent(pieDS.getKey(minSegment), explodePct.doubleValue());
        }
      }
      else
      {
        if (maxSegment >= 0)
        {
          pp.setExplodePercent(pieDS.getKey(maxSegment), explodePct.doubleValue());
        }
      }
    }

  }
View Full Code Here

  {
    super.configureChart(chart);

    final Plot plot = chart.getPlot();
    final PiePlot pp = (PiePlot) plot;
    final PieDataset pieDS = pp.getDataset();
    pp.setDirection(rotationClockwise ? Rotation.CLOCKWISE : Rotation.ANTICLOCKWISE);
    if ((explodeSegment != null) && (explodePct != null))
    {
      configureExplode(pp);
    }
    if (StringUtils.isEmpty(getTooltipFormula()) == false)
    {
      pp.setToolTipGenerator(new FormulaPieTooltipGenerator(getRuntime(), getTooltipFormula()));
    }
    if (StringUtils.isEmpty(getUrlFormula()) == false)
    {
      pp.setURLGenerator(new FormulaPieURLGenerator(getRuntime(), getUrlFormula()));
    }

    pp.setIgnoreNullValues(ignoreNulls);
    pp.setIgnoreZeroValues(ignoreZeros);
    if (Boolean.FALSE.equals(getItemsLabelVisible()))
    {
      pp.setLabelGenerator(null);
    }
    else
    {
      final StandardPieSectionLabelGenerator labelGen = new StandardPieSectionLabelGenerator(pieLabelFormat);
      pp.setLabelGenerator(labelGen);

      final StandardPieSectionLabelGenerator legendGen = new StandardPieSectionLabelGenerator(pieLegendLabelFormat);
      pp.setLegendLabelGenerator(legendGen);
    }

    if (StringUtils.isEmpty(getLabelFont()) == false)
    {
      pp.setLabelFont(Font.decode(getLabelFont()));
    }

    if (pieDS != null)
    {
      final String[] colors = getSeriesColor();
      for (int i = 0; i < colors.length; i++)
      {
        if (i < pieDS.getItemCount())
        {
          pp.setSectionPaint(pieDS.getKey(i), parseColorFromString(colors[i]));
        }
        else
        {
          break;
        }
View Full Code Here

  public MasterReport createReport() throws ReportDefinitionException
  {
    final MasterReport report = parseReport();
    // create a dataset...
    final PieDataset dataset = createSampleDataset();
    // create the chart...
    final JFreeChart chart = createChart(dataset);
    report.getParameterValues().put("Chart", chart);
    return report;
  }
View Full Code Here

  public MasterReport createReport() throws ReportDefinitionException
  {
    final MasterReport report = parseReport();
    // create a dataset...
    final PieDataset dataset = createSampleDataset();
    // create the chart...
    final JFreeChart chart = createChart(dataset);
    report.getParameterValues().put("Chart", chart);
    return report;
  }
View Full Code Here

    sectionDepth = 0.5;
  }

  protected JFreeChart computeChart(final Dataset dataset)
  {
    PieDataset pieDataset = null;
    if (dataset instanceof PieDataset)
    {
      pieDataset = (PieDataset) dataset;
    }
View Full Code Here

      piePlot.setLabelShadowPaint(ChartThemesConstants.TRANSPARENT_PAINT);
      piePlot.setLabelOutlinePaint(ChartThemesConstants.TRANSPARENT_PAINT);
    }
    piePlot.setShadowXOffset(0);
    piePlot.setShadowYOffset(0);
    PieDataset pieDataset = piePlot.getDataset();
    if(pieDataset != null)
    {
      for(int i = 0; i < pieDataset.getItemCount(); i++)
      {
        piePlot.setSectionOutlinePaint(pieDataset.getKey(i), ChartThemesConstants.TRANSPARENT_PAINT);
       
        //makes pie colors darker
        //piePlot.setSectionPaint(pieDataset.getKey(i), GRADIENT_PAINTS[i]);
      }
    }
View Full Code Here

//        0,
//        getChart().getHeight(),
//        Color.white)
//    );

    PieDataset pieDataset = piePlot3D.getDataset();
    if(pieDataset != null)
    {
      for(int i = 0; i < pieDataset.getItemCount(); i++)
      {
        piePlot3D.setSectionOutlinePaint(pieDataset.getKey(i), ChartThemesConstants.TRANSPARENT_PAINT);
      }
    }
    piePlot3D.setCircular(true);
    return jfreeChart;
  }
View Full Code Here

      piePlot.setLabelOutlinePaint(ChartThemesConstants.TRANSPARENT_PAINT);
    }
    piePlot.setShadowXOffset(5);
    piePlot.setShadowYOffset(10);
    piePlot.setShadowPaint(new GradientPaint(0, getChart().getHeight() / 2, new Color(41, 120, 162), 0, getChart().getHeight(), Color.white));
    PieDataset pieDataset = piePlot.getDataset();
    if(pieDataset != null)
    {
      for(int i = 0; i < pieDataset.getItemCount(); i++)
      {
        piePlot.setSectionOutlinePaint(pieDataset.getKey(i), ChartThemesConstants.TRANSPARENT_PAINT);
        //makes pie colors darker
        //piePlot.setSectionPaint(pieDataset.getKey(i), GRADIENT_PAINTS[i]);
      }
    }
   
View Full Code Here

//        0,
//        getChart().getHeight(),
//        Color.white)
//    );

    PieDataset pieDataset = piePlot3D.getDataset();
    if(pieDataset != null)
    {
      for(int i = 0; i < pieDataset.getItemCount(); i++)
      {
        piePlot3D.setSectionOutlinePaint(pieDataset.getKey(i), ChartThemesConstants.TRANSPARENT_PAINT);
      }
    }

    piePlot3D.setCircular(true);
    return jfreeChart;
View Full Code Here

TOP

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

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.