Java Code Examples for org.jfree.chart.plot.PiePlot3D#setStartAngle()

The following examples show how to use org.jfree.chart.plot.PiePlot3D#setStartAngle() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MultiExtXmlChartDemo.java    From pentaho-reporting with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
   * Creates a sample chart.
   *
   * @return A chart.
   */
  private JFreeChart createChart(final int year)
  {

    final JFreeChart chart = ChartFactory.createPieChart3D(
        "Programming Language of the Year " + year, // chart title
        createSampleDataset(), // data
        true, // include legend
        true,
        false
    );

    // set the background color for the chart...
    final PiePlot3D plot = (PiePlot3D) chart.getPlot();
    plot.setStartAngle(270);
//    plot.setDirection(Rotation.CLOCKWISE);
    plot.setForegroundAlpha(0.5f);
    plot.setNoDataMessage("No data to display");

    return chart;

  }
 
Example 2
Source File: TableJFreeChartDemo.java    From pentaho-reporting with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
   * Creates a sample chart.
   *
   * @return A chart.
   */
  private JFreeChart createChart(final int year, final int[] votes)
  {

    final JFreeChart chart = ChartFactory.createPieChart3D(
        "Programming Language of the Year " + (year), // chart title
        createSampleDataset(votes), // data
        true, // include legend
        true,
        false
    );

    // set the background color for the chart...
    final PiePlot3D plot = (PiePlot3D) chart.getPlot();
    plot.setStartAngle(270);
//    plot.setDirection(Rotation.CLOCKWISE);
    plot.setForegroundAlpha(0.5f);
    plot.setNoDataMessage("No data to display");

    return chart;

  }
 
Example 3
Source File: BasicExtXmlChartDemo.java    From pentaho-reporting with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
   * Creates a sample chart.
   *
   * @param dataset the dataset.
   * @return A chart.
   */
  private JFreeChart createChart(final PieDataset dataset)
  {

    final JFreeChart chart = ChartFactory.createPieChart3D(
        "Pie Chart 3D Demo 1", // chart title
        dataset, // data
        true, // include legend
        true,
        false
    );

    // set the background color for the chart...
    chart.setBackgroundPaint(Color.yellow);
    final PiePlot3D plot = (PiePlot3D) chart.getPlot();
    plot.setStartAngle(270);
//    plot.setDirection(Rotation.CLOCKWISE);
    plot.setForegroundAlpha(0.5f);
    plot.setNoDataMessage("No data to display");

    return chart;

  }
 
Example 4
Source File: MultiSimpleXmlChartDemo.java    From pentaho-reporting with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
   * Creates a sample chart.
   *
   * @return A chart.
   */
  private JFreeChart createChart(final int year)
  {

    final JFreeChart chart = ChartFactory.createPieChart3D(
        "Programming Language of the Year " + year, // chart title
        createSampleDataset(), // data
        true, // include legend
        true,
        false
    );

    // set the background color for the chart...
    final PiePlot3D plot = (PiePlot3D) chart.getPlot();
    plot.setStartAngle(270);
//    plot.setDirection(Rotation.CLOCKWISE);
    plot.setForegroundAlpha(0.5f);
    plot.setNoDataMessage("No data to display");

    return chart;

  }
 
Example 5
Source File: BasicSimpleXmlChartDemo.java    From pentaho-reporting with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
   * Creates a sample chart.
   *
   * @param dataset the dataset.
   * @return A chart.
   */
  private JFreeChart createChart(final PieDataset dataset)
  {

    final JFreeChart chart = ChartFactory.createPieChart3D(
        "Pie Chart 3D Demo 1", // chart title
        dataset, // data
        true, // include legend
        true,
        false
    );

    // set the background color for the chart...
    chart.setBackgroundPaint(Color.yellow);
    final PiePlot3D plot = (PiePlot3D) chart.getPlot();
    plot.setStartAngle(270);
//    plot.setDirection(Rotation.CLOCKWISE);
    plot.setForegroundAlpha(0.5f);
    plot.setNoDataMessage("No data to display");

    return chart;

  }
 
Example 6
Source File: MultiAPIChartDemo.java    From pentaho-reporting with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
   * Creates a sample chart.
   *
   * @return A chart.
   */
  private JFreeChart createChart(final int year)
  {

    final JFreeChart chart = ChartFactory.createPieChart3D(
        "Programming Language of the Year " + year, // chart title
        createSampleDataset(), // data
        true, // include legend
        true,
        false
    );

    // set the background color for the chart...
    final PiePlot3D plot = (PiePlot3D) chart.getPlot();
    plot.setStartAngle(270);
//    plot.setDirection(Rotation.CLOCKWISE);
    plot.setForegroundAlpha(0.5f);
    plot.setNoDataMessage("No data to display");

    return chart;

  }
 
Example 7
Source File: JFreeChartScriptlet.java    From jasperreports with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void afterReportInit() throws JRScriptletException
{
	DefaultPieDataset dataset = new DefaultPieDataset();
	dataset.setValue("Java", 43.2d);
	dataset.setValue("Visual Basic", 10.0d);
	dataset.setValue("C/C++", 17.5d);
	dataset.setValue("PHP", 32.5d);
	dataset.setValue("Perl", 1.0d);

	JFreeChart chart = 
		ChartFactory.createPieChart3D(
			"Pie Chart 3D Demo 1",
			dataset,
			true,
			true,
			false
			);

	PiePlot3D plot = (PiePlot3D) chart.getPlot();
	plot.setStartAngle(290);
	plot.setDirection(Rotation.CLOCKWISE);
	plot.setForegroundAlpha(0.5f);
	plot.setNoDataMessage("No data to display");

	/*   */
	this.setVariableValue("Chart", new JCommonDrawableRendererImpl(chart));
}
 
Example 8
Source File: TransitionsPieChart.java    From osmo with GNU Lesser General Public License v2.1 5 votes vote down vote up
private JFreeChart createChart(String title) {
  JFreeChart chart = ChartFactory.createPieChart3D(title, data, true, true, false);
  PiePlot3D plot = (PiePlot3D) chart.getPlot();
  plot.setStartAngle(290);
  plot.setDirection(Rotation.CLOCKWISE);
  plot.setForegroundAlpha(0.5f);
  return chart;
}
 
Example 9
Source File: PieChartWrapper.java    From mycollab with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
protected JFreeChart createChart() {
    // create the chart...
    pieDataSet = createDataset();
    final JFreeChart chart = ChartFactory.createPieChart3D("", // chart
            // title
            pieDataSet, // data
            false, // include legend
            true, // tooltips?
            false // URLs?
    );

    // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...
    chart.getTitle().setPaint(new Color(0x5E5E5E));
    chart.setBorderVisible(false);
    // set the background color for the chart...
    final PiePlot3D plot = (PiePlot3D) chart.getPlot();
    plot.setOutlineVisible(false);
    plot.setInsets(RectangleInsets.ZERO_INSETS);
    plot.setStartAngle(290);
    plot.setBackgroundPaint(Color.white);
    plot.setDirection(Rotation.CLOCKWISE);
    plot.setForegroundAlpha(0.5f);
    plot.setNoDataMessage("No data to display");
    plot.setLabelGenerator(new JFreeChartLabelCustom());

    final List keys = pieDataSet.getKeys();
    for (int i = 0; i < keys.size(); i++) {
        final Comparable key = (Comparable) keys.get(i);
        int colorIndex = i % CHART_COLOR_STR.size();
        plot.setSectionPaint(key, Color.decode("0x" + CHART_COLOR_STR.get(colorIndex)));
    }
    // OPTIONAL CUSTOMISATION COMPLETED.
    return chart;
}
 
Example 10
Source File: PieChartTab.java    From mars-sim with GNU General Public License v3.0 4 votes vote down vote up
/**
   * Create a PieChart view that displays the data in a particular column.
   *
   * @param model Data source.
   * @param column Index of the column to collate.
   */
  public PieChartTab(MonitorModel model, int column) {
      super(model, false, ImageLoader.getNewIcon(MonitorWindow.PIE_ICON));

      String title = model.getName() + " - " + model.getColumnName(column);
      setName(title);

      pieModel = new TablePieDataset(model, column);

      chart = ChartFactory.createPieChart3D(null, pieModel, true, true, false);
      chart.setBackgroundPaint(getBackground());

      pieModel.calculate();

      // 2015-10-18 Changed to 3D pie
      final PiePlot3D plot = (PiePlot3D)chart.getPlot();

      //plot.setCircular(false);
      //plot.setRadius(0.60);
      //plot.setSectionLabelType(PiePlot.PERCENT_LABELS);

      plot.setStartAngle(270);
      plot.setDirection(Rotation.ANTICLOCKWISE);
      plot.setForegroundAlpha(0.6f);
      //plot.setInteriorGap(0.33);

      pieModel.addChangeListener(plot);

      chartpanel = new ChartPanel(chart, true);

      // 2015-10-18 Added setting below to keep the aspect ratio of 8:5
      // see http://www.jfree.org/forum/viewtopic.php?f=3&t=115763
      // Chart will always be drawn to an off-screen buffer that is the same size as the ChartPanel, so no scaling will happen when the offscreen image is copied to the panel.
      chartpanel.setPreferredSize(new Dimension (800, 300));
      chartpanel.setMinimumDrawWidth(0);
      chartpanel.setMaximumDrawWidth(Integer.MAX_VALUE);
      chartpanel.setMinimumDrawHeight(0);
      chartpanel.setMaximumDrawHeight(Integer.MAX_VALUE);

JPanel fixedSizePane = new JPanel(new FlowLayout());
fixedSizePane.add(chartpanel);
fixedSizePane.addComponentListener(new ComponentAdapter() {
          @Override
          public void componentResized(ComponentEvent e) {
          	int w = fixedSizePane.getWidth();
              int h = fixedSizePane.getHeight();
              int size =  Math.min(w, h);
              int newWidth = (int) (size *8D/3D);
              chartpanel.setPreferredSize(new Dimension(newWidth, size));
              fixedSizePane.revalidate();
          }
      });

      add(fixedSizePane, BorderLayout.CENTER);

      // 2015-10-18 Added rotator code
      final Rotator rotator = new Rotator(plot);
      rotator.start();
//System.out.println("PieChartTab : just done calling constructor");
  }