Esempio n. 1
0
 private static JFreeChart createChart(PieDataset dataset, String title) {
   JFreeChart chart = ChartFactory.createPieChart3D(title, dataset, true, true, false);
   PiePlot3D plot = (PiePlot3D) chart.getPlot();
   plot.setStartAngle(290.0d);
   plot.setDirection(Rotation.CLOCKWISE);
   plot.setForegroundAlpha(JFreeChart.DEFAULT_BACKGROUND_IMAGE_ALPHA);
   return chart;
 }
Esempio n. 2
0
 private static JFreeChart createChart(PieDataset piedataset) {
   JFreeChart jfreechart =
       ChartFactory.createPieChart3D("Statitic", piedataset, true, false, false);
   PiePlot3D pieplot3d = (PiePlot3D) jfreechart.getPlot();
   pieplot3d.setStartAngle(270D);
   pieplot3d.setDirection(Rotation.ANTICLOCKWISE);
   pieplot3d.setForegroundAlpha(0.6F);
   return jfreechart;
 }
  // creates JFreeChart pie chart with data set
  private JFreeChart createPieChart(PieDataset dataSet, String title) {
    JFreeChart chart =
        ChartFactory.createPieChart3D(
            title, // chart title
            dataSet, // data
            true, // include legend
            true, false);

    PiePlot3D plot = (PiePlot3D) chart.getPlot();
    plot.setStartAngle(290);
    plot.setDirection(Rotation.CLOCKWISE);
    plot.setForegroundAlpha(0.5f);
    return 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);
   final PiePlot3D plot = (PiePlot3D) chart.getPlot();
   plot.setStartAngle(290);
   plot.setDirection(Rotation.CLOCKWISE);
   plot.setForegroundAlpha(0.5f);
   plot.setNoDataMessage("No data to display");
   return chart;
 }
Esempio n. 5
0
 public InputStream create3DPieChart(String title, PieDataset data, int pngwidth, int pngheight)
     throws IOException {
   JFreeChart localJFreeChart = ChartFactory.createPieChart3D(title, data, true, true, false);
   PiePlot3D localPiePlot3D = (PiePlot3D) localJFreeChart.getPlot();
   localPiePlot3D.setStartAngle(290.0D);
   localPiePlot3D.setDirection(Rotation.CLOCKWISE);
   localPiePlot3D.setForegroundAlpha(0.5F);
   localPiePlot3D.setNoDataMessage("No data to display");
   localPiePlot3D.setSectionPaint(0, new Color(152, 251, 152));
   localPiePlot3D.setSectionPaint(1, new Color(238, 221, 130));
   localPiePlot3D.setSectionPaint(2, new Color(255, 62, 150));
   localPiePlot3D.setSectionPaint(3, new Color(139, 0, 0));
   localPiePlot3D.setSectionPaint(4, new Color(181, 181, 181));
   ChartRenderingInfo info = new ChartRenderingInfo();
   BufferedImage bi =
       localJFreeChart.createBufferedImage(pngwidth, pngheight, BufferedImage.SCALE_FAST, info);
   ByteArrayOutputStream bs = new ByteArrayOutputStream();
   ImageOutputStream imOut = ImageIO.createImageOutputStream(bs);
   ImageIO.write(bi, "GIF", imOut);
   // scaledImage1ΪBufferedImage£¬jpgΪͼÏñµÄÀàÐÍ
   InputStream istream = new ByteArrayInputStream(bs.toByteArray());
   return istream;
 }