List of usage examples for org.jfree.chart.plot PiePlot setSectionOutlinePaint
public void setSectionOutlinePaint(int section, Paint paint)
From source file:canreg.client.analysis.Tools.java
public static void setPiePlotColours(JFreeChart chart, int numberOfSections, Color baseColor) { Color color = baseColor;/*from ww w.j a v a 2s. c o m*/ PiePlot plot = (PiePlot) chart.getPlot(); for (int i = 0; i < numberOfSections; i++) { try { plot.setSectionOutlinePaint(plot.getDataset().getKey(i), baseColor.darker().darker().darker()); color = darken(color); plot.setSectionPaint(plot.getDataset().getKey(i), color); } catch (java.lang.IndexOutOfBoundsException ex) { // not data for all the categories - that is fine Logger.getLogger(TopNChartTableBuilder.class.getName()).log(Level.INFO, null, ex); } } }
From source file:org.openfaces.component.chart.impl.configuration.OutlineConfigurator.java
public void configure(ConfigurablePlot plot, ChartView view) { PiePlot piePlot = (PiePlot) plot; boolean outlinesSpecified = view.getOutlines() != null && !view.getOutlines().isEmpty(); if (view.getDefaultOutlineStyle() != null && !outlinesSpecified) { piePlot.setBaseSectionOutlinePaint(view.getDefaultOutlineStyle().getColor()); piePlot.setBaseSectionOutlineStroke(view.getDefaultOutlineStyle().getStroke()); for (int seriesIndex = 0; seriesIndex < seriesCount; seriesIndex++) { piePlot.setSectionOutlinePaint(seriesIndex, view.getDefaultOutlineStyle().getColor()); piePlot.setSectionOutlineStroke(seriesIndex, view.getDefaultOutlineStyle().getStroke()); }// w w w.j ava2s.co m } else if (outlinesSpecified) { final Iterator outlinesIterator = view.getOutlines().iterator(); for (int seriesIndex = 0; seriesIndex < seriesCount; seriesIndex++) { if (outlinesIterator.hasNext()) { final LineStyle lineStyle = (LineStyle) outlinesIterator.next(); piePlot.setSectionOutlinePaint(seriesIndex, lineStyle.getColor()); piePlot.setSectionOutlineStroke(seriesIndex, lineStyle.getStroke()); } } } }
From source file:org.openfaces.component.chart.impl.configuration.PlotSelectionConfigurator.java
private void setupPieChartSelection(PiePlot plot, Chart chart) { if (((PieChartView) chart.getChartView()).getSelectedSector() != null) { final PieSectorInfo info = ((PieChartView) chart.getChartView()).getSelectedSector(); final ChartSelection selection = chart.getChartSelection(); final LineStyle lineStyle = selection.getLineStyle(); Paint outlinePaint = lineStyle.getColor() != null ? lineStyle.getColor() : Color.WHITE; final Stroke outlineStroke = lineStyle.getStroke(); final Paint selectionPaint = selection.getFillPaint(); plot.setSectionOutlinePaint(info.getIndex(), outlinePaint); if (outlineStroke != null) { plot.setSectionOutlineStroke(info.getIndex(), outlineStroke); }/*from ww w .j av a 2 s . c om*/ if (selectionPaint != null) { plot.setSectionPaint(info.getIndex(), selectionPaint); } } }
From source file:net.sqs2.omr.result.export.chart.ChartImageWriter.java
private void setSectionPaint(PieDataset dataSet, PiePlot piePlot) { Paint outlinePaint = Color.BLACK; Stroke outlineStroke = new BasicStroke(1.0f); if (this.itemBackgroundImages != null && 0 < this.itemBackgroundImages.length) { int index = 0; for (Object key : dataSet.getKeys()) { int imageIndex = index % this.itemBackgroundImages.length; BufferedImage texture = this.itemBackgroundImages[imageIndex]; Rectangle2D anchor = new Rectangle2D.Double(0, 0, texture.getWidth(), texture.getHeight()); TexturePaint fillPaint = new TexturePaint(texture, anchor); piePlot.setSectionPaint((Comparable<?>) key, fillPaint); piePlot.setSectionOutlinePaint((Comparable<?>) key, outlinePaint); piePlot.setSectionOutlineStroke((Comparable<?>) key, outlineStroke); index++;/*w w w . j ava2s . c om*/ } } piePlot.setOutlineVisible(true); piePlot.setOutlinePaint(outlinePaint); piePlot.setOutlineStroke(outlineStroke); piePlot.setSectionOutlinesVisible(true); piePlot.setBaseSectionOutlinePaint(outlinePaint); piePlot.setBaseSectionOutlineStroke(outlineStroke); }
From source file:net.sf.fspdfs.chartthemes.spring.AegeanChartTheme.java
/** * *///from w ww . j ava2 s . c o m protected JFreeChart createPieChart() throws JRException { JFreeChart jfreeChart = super.createPieChart(); PiePlot piePlot = (PiePlot) jfreeChart.getPlot(); piePlot.setLabelBackgroundPaint(ChartThemesConstants.TRANSPARENT_PAINT); 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]); } } piePlot.setCircular(true); return jfreeChart; }
From source file:net.sf.jasperreports.chartthemes.spring.AegeanChartTheme.java
@Override protected JFreeChart createPieChart() throws JRException { JFreeChart jfreeChart = super.createPieChart(); PiePlot piePlot = (PiePlot) jfreeChart.getPlot(); JRPiePlot jrPiePlot = (JRPiePlot) getPlot(); boolean isShowLabels = jrPiePlot.getShowLabels() == null ? true : jrPiePlot.getShowLabels(); if (isShowLabels && piePlot.getLabelGenerator() != null) { piePlot.setLabelBackgroundPaint(ChartThemesConstants.TRANSPARENT_PAINT); piePlot.setLabelShadowPaint(ChartThemesConstants.TRANSPARENT_PAINT); piePlot.setLabelOutlinePaint(ChartThemesConstants.TRANSPARENT_PAINT); }// w w w .j av a 2 s . com 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]); } } piePlot.setCircular(true); return jfreeChart; }
From source file:net.sf.fspdfs.chartthemes.spring.EyeCandySixtiesChartTheme.java
/** * *//*from w ww. ja v a 2s . co m*/ protected JFreeChart createPieChart() throws JRException { JFreeChart jfreeChart = super.createPieChart(); PiePlot piePlot = (PiePlot) jfreeChart.getPlot(); piePlot.setLabelBackgroundPaint(ChartThemesConstants.TRANSPARENT_PAINT); piePlot.setLabelShadowPaint(ChartThemesConstants.TRANSPARENT_PAINT); 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]); } } piePlot.setCircular(true); return jfreeChart; }
From source file:net.sf.jasperreports.chartthemes.spring.EyeCandySixtiesChartTheme.java
@Override protected JFreeChart createPieChart() throws JRException { JFreeChart jfreeChart = super.createPieChart(); PiePlot piePlot = (PiePlot) jfreeChart.getPlot(); JRPiePlot jrPiePlot = (JRPiePlot) getPlot(); boolean isShowLabels = jrPiePlot.getShowLabels() == null ? true : jrPiePlot.getShowLabels(); if (isShowLabels && piePlot.getLabelGenerator() != null) { piePlot.setLabelBackgroundPaint(ChartThemesConstants.TRANSPARENT_PAINT); piePlot.setLabelShadowPaint(ChartThemesConstants.TRANSPARENT_PAINT); piePlot.setLabelOutlinePaint(ChartThemesConstants.TRANSPARENT_PAINT); }//from w ww . j a va 2 s . c o m 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]); } } piePlot.setCircular(true); return jfreeChart; }
From source file:org.openfaces.component.chart.impl.plots.PiePlotAdapter.java
private void sectorProcessing(PiePlot plot, PieChartView chartView, PieDataset dataset, CategoryDataset categoryDataset) { List<PieSectorProperties> sectors = chartView.getSectors(); if (sectors == null || sectors.size() == 0) return;/*from www . j a v a 2 s . c o m*/ for (PieSectorProperties sector : sectors) { DynamicPieGenerator generator = new DynamicPieGenerator(chartView, null); int index = -1; Float sectorPulled = sector.getPulled(); if (dataset instanceof CategoryToPieDataset) { CategoryToPieDataset cds = (CategoryToPieDataset) dataset; int count = getIterationCount(cds); for (int q = 0; q < count; q++) { CategoryToPieDataset currPieDataset = new CategoryToPieDataset(categoryDataset, order, q); List keys = currPieDataset.getKeys(); index = -1; for (int j = 0; j < keys.size(); j++) { index++; boolean conditionValue = generator.getConditionValue(sector, q, currPieDataset, currPieDataset.getKey(j)); if (!conditionValue) continue; if (sectorPulled != null && sectorPulled > 0) { plot.setExplodePercent(index, (double) sectorPulled); } StyleObjectModel cssSectorModel = sector.getStyleObjectModel(); if (cssSectorModel != null && cssSectorModel.getBorder() != null) { StyleBorderModel border = cssSectorModel.getBorder(); Color borderColor = border.getColor(); if (borderColor != null) { plot.setSectionOutlinePaint(index, borderColor); plot.setSectionOutlineStroke(index, PropertiesConverter.toStroke(border)); } Color sectorModelColor = cssSectorModel.getColor(); if (sectorModelColor != null) { plot.setSectionPaint(index, sectorModelColor); } } } } } else { if (dataset == null || dataset.getKeys() == null) continue; for (int j = 0; j < dataset.getKeys().size(); j++) { index++; boolean conditionValue = generator.getConditionValue(sector, 0, dataset, dataset.getKey(j)); if (!conditionValue) continue; if (sectorPulled != null && sectorPulled > 0) { plot.setExplodePercent(index, (double) sectorPulled); } StyleObjectModel cssSectorModel = sector.getStyleObjectModel(); if (cssSectorModel != null && cssSectorModel.getBorder() != null) { StyleBorderModel border = cssSectorModel.getBorder(); if (border.getColor() != null) { plot.setSectionOutlinePaint(index, border.getColor()); plot.setSectionOutlineStroke(index, PropertiesConverter.toStroke(border)); } } if (cssSectorModel != null && cssSectorModel.getColor() != null) { plot.setSectionPaint(index, cssSectorModel.getColor()); } } } } }
From source file:org.openfaces.component.chart.impl.plots.PiePlot3DAdapter.java
private void sectorProcessing(PiePlot plot, PieChartView chartView, PieDataset dataset, CategoryDataset categoryDataset) { java.util.List<PieSectorProperties> sectors = chartView.getSectors(); if (sectors == null || sectors.size() == 0) return;/*from w w w . ja va2 s . co m*/ for (PieSectorProperties sector : sectors) { DynamicPieGenerator generator = new DynamicPieGenerator(chartView, null); int index = -1; Float sectorPulled = sector.getPulled(); if (dataset instanceof CategoryToPieDataset) { CategoryToPieDataset cds = (CategoryToPieDataset) dataset; int count = getIterationCount(cds); for (int q = 0; q < count; q++) { CategoryToPieDataset currPieDataset = new CategoryToPieDataset(categoryDataset, order, q); java.util.List keys = currPieDataset.getKeys(); index = -1; for (int j = 0; j < keys.size(); j++) { index++; boolean conditionValue = generator.getConditionValue(sector, q, currPieDataset, currPieDataset.getKey(j)); if (!conditionValue) continue; if (sectorPulled != null && sectorPulled > 0) { plot.setExplodePercent(index, (double) sectorPulled); } StyleObjectModel cssSectorModel = sector.getStyleObjectModel(); if (cssSectorModel != null && cssSectorModel.getBorder() != null) { StyleBorderModel border = cssSectorModel.getBorder(); Color borderColor = border.getColor(); if (borderColor != null) { plot.setSectionOutlinePaint(index, borderColor); plot.setSectionOutlineStroke(index, PropertiesConverter.toStroke(border)); } Color sectorModelColor = cssSectorModel.getColor(); if (sectorModelColor != null) { plot.setSectionPaint(index, sectorModelColor); } } } } } else { if (dataset == null || dataset.getKeys() == null) continue; for (int j = 0; j < dataset.getKeys().size(); j++) { index++; boolean conditionValue = generator.getConditionValue(sector, 0, dataset, dataset.getKey(j)); if (!conditionValue) continue; if (sectorPulled != null && sectorPulled > 0) { plot.setExplodePercent(index, (double) sectorPulled); } StyleObjectModel cssSectorModel = sector.getStyleObjectModel(); if (cssSectorModel != null && cssSectorModel.getBorder() != null) { StyleBorderModel border = cssSectorModel.getBorder(); if (border.getColor() != null) { plot.setSectionOutlinePaint(index, border.getColor()); plot.setSectionOutlineStroke(index, PropertiesConverter.toStroke(border)); } } if (cssSectorModel != null && cssSectorModel.getColor() != null) { plot.setSectionPaint(index, cssSectorModel.getColor()); } } } } }