List of usage examples for org.jfree.chart.plot PiePlot setStartAngle
public void setStartAngle(double angle)
From source file:userinterface.CountryNetworkAdminRole.CountryReportsJPanel.java
public JFreeChart createDonorsReportsChart(PieDataset dataSet, String chartTitle) { JFreeChart chart = ChartFactory.createPieChart(chartTitle, dataSet, true, true, false); PiePlot plot = (PiePlot) chart.getPlot(); plot.setStartAngle(0); plot.setDirection(Rotation.CLOCKWISE); plot.setNoDataMessage("No data available"); plot.setCircular(false);/*from w w w. j av a 2 s .com*/ plot.setLabelGap(0.02); return chart; }
From source file:userinterface.CountryNetworkAdminRole.CountryReportsJPanel.java
public JFreeChart createPatientReportsChart(PieDataset dataSet, String chartTitle) { //ChartFactory.createPieChart(chartTitle, dataSet, true, true, false); JFreeChart chart = ChartFactory.createPieChart(chartTitle, dataSet, true, true, false); PiePlot plot = (PiePlot) chart.getPlot(); plot.setStartAngle(0); plot.setDirection(Rotation.CLOCKWISE); //plot.setForegroundAlpha(0.8f); plot.setNoDataMessage("No data available"); plot.setCircular(false);// w ww . ja v a2 s .co m plot.setLabelGap(0.02); return chart; }
From source file:de.main.sessioncreator.ReportingHelper.java
/** * Creates a chart/*from w w w . j a va2s .c o m*/ */ private JFreeChart createChart(PieDataset dataset, String title) { // JFreeChart chart = ChartFactory.createPieChart3D( JFreeChart chart = ChartFactory.createPieChart(title, // chart title dataset, // data false, // include legend true, false); // PiePlot3D plot = (PiePlot3D) chart.getPlot(); PiePlot plot = (PiePlot) chart.getPlot(); plot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0} = {2}", NumberFormat.getNumberInstance(), NumberFormat.getPercentInstance())); plot.setStartAngle(90); plot.setDirection(Rotation.CLOCKWISE); plot.setForegroundAlpha(0.5f); return chart; }
From source file:edu.isistan.carcha.plugin.editors.DXMIEditor.java
/** * Creates the PieChart page./* w w w . java 2 s . com*/ */ void createPieChartPage() { result = new DefaultPieDataset(); JFreeChart chart = ChartFactory.createPieChart("Design Decisions", result, true, true, false); PiePlot plot = (PiePlot) chart.getPlot(); plot.setStartAngle(290); plot.setDirection(Rotation.CLOCKWISE); plot.setForegroundAlpha(0.5f); Composite composite = new Composite(getContainer(), SWT.NONE); FillLayout layout = new FillLayout(); composite.setLayout(layout); new ChartComposite(composite, SWT.NONE, chart, true); int index = addPage(composite); setPageText(index, "Graph"); }
From source file:org.pentaho.chart.plugin.jfreechart.chart.pie.JFreePieChartGenerator.java
private void setStartAngle(final PiePlot piePlot, ChartElement plotElement) { final LayoutStyle layoutStyle = plotElement.getLayoutStyle(); final CSSValue startAngle = layoutStyle.getValue(ChartStyleKeys.PIE_START_ANGLE); if (startAngle instanceof CSSNumericValue) { piePlot.setStartAngle(((CSSNumericValue) startAngle).getValue()); }//from w w w.j a v a2s . c om }
From source file:org.codehaus.mojo.dashboard.report.plugin.chart.PieChartRenderer.java
public void createChart() { PieDataset dataset = (PieDataset) this.datasetStrategy.getDataset(); report = ChartFactory.createPieChart(this.datasetStrategy.getTitle(), dataset, true, true, false); PiePlot plot = (PiePlot) report.getPlot(); // plot.setCircular( false ); plot.setDirection(Rotation.ANTICLOCKWISE); /*/* w w w. ja va 2s.com*/ * plot.setExplodePercent(0, 0.15D); plot.setExplodePercent(1, 0.15D); */ // plot.setInteriorGap( PieChartRenderer.INTERIOR_GAP ); plot.setLabelFont(new Font("Lucida", 0, PieChartRenderer.FONT_SIZE)); plot.setLabelGap(PieChartRenderer.LABEL_GAP); plot.setNoDataMessage("No data available"); plot.setStartAngle(PieChartRenderer.START_ANGLE); Paint[] paints = this.datasetStrategy.getPaintColor(); for (int i = 0; i < dataset.getItemCount() && i < paints.length; i++) { plot.setSectionPaint(dataset.getKey(i), paints[i]); } }
From source file:org.jfree.eastwood.ChartEngine.java
/** * Creates a pie chart.// ww w . ja v a 2 s.com * * @return A pie chart. */ private static JFreeChart createPieChart() { JFreeChart chart = ChartFactory.createPieChart(null, null, false, true, false); chart.setBackgroundPaint(Color.white); PiePlot plot = (PiePlot) chart.getPlot(); plot.setBackgroundPaint(null); plot.setInsets(RectangleInsets.ZERO_INSETS); plot.setInteriorGap(0.06); plot.setStartAngle(0.0); plot.setLabelGenerator(null); plot.setBaseSectionOutlinePaint(Color.white); plot.setBaseSectionOutlineStroke(new BasicStroke(1.2f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND)); plot.setOutlineVisible(false); plot.setLabelBackgroundPaint(null); 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:edu.isistan.carcha.plugin.editors.TraceabilityEditor.java
/** * Creates the impact Pie Chart page. It allows users to select a Crosscutting Concern and see Design Decision type distribution *//*w w w. j a va2s . c o m*/ void impactPieChartPage() { ddDataset = new DefaultPieDataset(); impactDataset = new DefaultPieDataset(); JFreeChart ddChart = ChartFactory.createPieChart("Crosscutting Concerns", ddDataset, true, true, false); JFreeChart impactChart = ChartFactory.createPieChart("Design Decisions", impactDataset, true, true, false); PiePlot ddPlot = (PiePlot) ddChart.getPlot(); ddPlot.setStartAngle(290); ddPlot.setDirection(Rotation.CLOCKWISE); ddPlot.setForegroundAlpha(0.5f); PiePlot impactPlot = (PiePlot) impactChart.getPlot(); impactPlot.setStartAngle(290); impactPlot.setDirection(Rotation.CLOCKWISE); impactPlot.setForegroundAlpha(0.5f); PieSectionLabelGenerator gen = new StandardPieSectionLabelGenerator("{0} ({2})"); ddPlot.setLabelGenerator(gen); impactPlot.setLabelGenerator(gen); Composite composite = new Composite(getContainer(), SWT.NONE); FillLayout layout = new FillLayout(); composite.setLayout(layout); final ChartComposite cComposite = new ChartComposite(composite, SWT.NONE, ddChart, true); cComposite.addChartMouseListener(new ChartMouseListener() { @Override public void chartMouseClicked(ChartMouseEvent event) { String[] parts = event.getEntity().getToolTipText().split(":"); HashMap<String, Integer> values = PluginUtil.getDDDistributionForCrossCuttingConcern(cp, parts[0]); logger.info("Impact Pie Chart for: " + parts[0]); impactDataset.clear(); for (String key : values.keySet()) { impactDataset.setValue(key, values.get(key)); } } @Override public void chartMouseMoved(ChartMouseEvent event) { } }); new ChartComposite(composite, SWT.NONE, impactChart, true); int index = addPage(composite); setPageText(index, "Graph"); }
From source file:net.sf.eclipsecs.ui.stats.views.GraphStatsView.java
/** * Cre le graphe JFreeChart./* w w w.j a v a 2 s .c om*/ * * @param piedataset * : la source de donnes afficher * @return le diagramme */ private JFreeChart createChart(GraphPieDataset piedataset) { JFreeChart jfreechart = ChartFactory.createPieChart3D(null, piedataset, false, true, false); jfreechart.setAntiAlias(true); jfreechart.setTextAntiAlias(true); PiePlot pieplot3d = (PiePlot) jfreechart.getPlot(); pieplot3d.setInsets(new RectangleInsets(0, 0, 0, 0)); final double angle = 290D; pieplot3d.setStartAngle(angle); pieplot3d.setDirection(Rotation.CLOCKWISE); final float foreground = 0.5F; pieplot3d.setForegroundAlpha(foreground); pieplot3d.setNoDataMessage(Messages.GraphStatsView_noDataToDisplay); pieplot3d.setCircular(true); pieplot3d.setOutlinePaint(null); pieplot3d.setLabelFont(new Font("SansSerif", Font.PLAIN, 10)); pieplot3d.setLabelGap(0.02); pieplot3d.setLabelOutlinePaint(null); pieplot3d.setLabelShadowPaint(null); pieplot3d.setLabelBackgroundPaint(Color.WHITE); pieplot3d.setBackgroundPaint(Color.WHITE); pieplot3d.setInteriorGap(0.02); pieplot3d.setMaximumLabelWidth(0.20); return jfreechart; }
From source file:com.jd.survey.web.statistics.StatisticsController.java
@Secured({ "ROLE_ADMIN", "ROLE_SURVEY_ADMIN" }) private JFreeChart createChart(PieDataset pieDataset, String title) { try {//from w ww.j a v a2 s . c o m JFreeChart chart = ChartFactory.createPieChart(title, pieDataset, false, true, false); chart.setBackgroundPaint(null);//this line necessary for transparency of background final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setOpaque(false); //this line necessary for transparency of background chartPanel.setBackground(new Color(0, 0, 0, 0)); //this line necessary for transparency of background PiePlot plot = (PiePlot) chart.getPlot(); //Color[] colors = {new Color(170, 195, 217, 255),new Color(246, 140, 31, 255),new Color(204, 204, 204, 255),new Color(231, 238, 144, 255),new Color(51, 51, 51, 255),new Color(101, 125, 151, 255),new Color(0, 102, 255, 255)}; //PieRenderer renderer = new PieRenderer(colors); //renderer.setColor(plot, pieDataset); PieSectionLabelGenerator generator = new StandardPieSectionLabelGenerator("{0}:{1}%"); plot.setLabelGenerator(generator); plot.setStartAngle(270); plot.setDirection(Rotation.CLOCKWISE); return chart; } catch (Exception e) { log.error(e.getMessage(), e); throw (new RuntimeException(e)); } }