List of usage examples for org.jfree.chart.plot PiePlot3D setOutlineVisible
public void setOutlineVisible(boolean visible)
From source file:org.jfree.eastwood.ChartEngine.java
/** * Creates a pie chart with 3D effect.//w w w . j a va2s . c om * * @return A pie chart. */ private static JFreeChart createPieChart3D() { JFreeChart chart = ChartFactory.createPieChart3D(null, null, false, true, false); chart.setBackgroundPaint(Color.white); chart.setBorderPaint(Color.white); PiePlot3D plot = (PiePlot3D) chart.getPlot(); plot.setInsets(RectangleInsets.ZERO_INSETS); plot.setDarkerSides(true); plot.setBaseSectionOutlinePaint(new Color(0, 0, 0, 0)); plot.setStartAngle(0.0); plot.setInteriorGap(0.10); plot.setLabelGenerator(null); plot.setOutlineVisible(false); plot.setLabelBackgroundPaint(Color.white); plot.setLabelOutlinePaint(null); plot.setLabelShadowPaint(null); plot.setLabelPadding(RectangleInsets.ZERO_INSETS); plot.setLabelFont(new Font("Dialog", Font.PLAIN, 12)); plot.setLabelPaint(Color.darkGray); plot.setToolTipGenerator(new StandardPieToolTipGenerator("{2}")); return chart; }
From source file:GroupProject.OriginalChartUI.java
/** * The method to draw pie chart/* www . ja v a2 s. c o m*/ * @param pieChartData the data used in the pie chart * @param pieTitle the measurement of pie chart */ public void drawPieChart(Map<String, Long> pieChartData, String pieTitle) { String title = pieTitle; ArrayList<String> keyArrayList = new ArrayList<>(); ArrayList<Long> valueArrayList = new ArrayList<>(); ArrayList<Color> colorArrayList = new ArrayList<>(); colorArrayList.add(new Color(222, 235, 247)); colorArrayList.add(new Color(109, 166, 217)); colorArrayList.add(new Color(155, 195, 230)); colorArrayList.add(new Color(126, 146, 222)); colorArrayList.add(new Color(96, 158, 218)); colorArrayList.add(new Color(53, 132, 203)); colorArrayList.add(new Color(46, 116, 180)); colorArrayList.add(new Color(31, 77, 119)); DefaultPieDataset dataset = new DefaultPieDataset(); Set set = pieChartData.keySet(); for (Map.Entry<String, Long> data : pieChartData.entrySet()) { String key = data.getKey(); Long value = data.getValue(); keyArrayList.add(key); valueArrayList.add(value); } for (int i = 0; i < valueArrayList.size(); i++) { dataset.setValue(keyArrayList.get(i), valueArrayList.get(i)); } JFreeChart chart = ChartFactory.createPieChart3D(title, dataset); chart.setBorderVisible(false); chart.setBorderPaint(new Color(255, 255, 255)); PiePlot3D plot = (PiePlot3D) chart.getPlot(); for (int i = 0; i < valueArrayList.size(); i++) { Color color = colorArrayList.get(i); plot.setSectionPaint(keyArrayList.get(i), color); } plot.setOutlineVisible(false); plot.setForegroundAlpha(0.6f); plot.setStartAngle(0); plot.setBackgroundPaint(new java.awt.Color(255, 255, 255)); ChartPanel chartPanel = new ChartPanel(chart); chartDisplayPanel.removeAll(); chartDisplayPanel.add(chartPanel, BorderLayout.CENTER); chartDisplayPanel.validate(); }