plot.setSectionPaint(KEY1, Color.green); plot.setSectionPaint(KEY2, Color.red); plot.setExplodePercent(KEY1, 0.10); plot.setSimpleLabels(true);
/** * Sets the amount that a pie section should be exploded and sends a * {@link PlotChangeEvent} to all registered listeners. * * @param section the section index. * @param percent the explode percentage (0.30 = 30 percent). * * @deprecated Use {@link #setExplodePercent(Comparable, double)} instead. */ public void setExplodePercent(int section, double percent) { Comparable key = getSectionKey(section); setExplodePercent(key, percent); }
/** * Handle pie plot customization * - get customization parameters from parameter Map and modify plot accordingly * @param parameters macro parameters * @param plot chart plot */ void handlePiePlotCustomization(Map parameters, PiePlot plot) { // Pie section label customization String pieSectionLabel = getStringParameter(parameters, "piesectionlabel", "%0%") // default to just show key .replaceAll("%0%", "\\{0\\}") // convert to what jfreechart uses - unfortunately {and } cause problems in parameters .replaceAll("%1%", "\\{1\\}") .replaceAll("%2%", "\\{2\\}"); plot.setLabelGenerator(new StandardPieSectionLabelGenerator(pieSectionLabel)); // Pie section explode - just simple to start with, requires jfreechart 1.0.3 or above // - need a comma separated list of key=value pairs to support fully if (ChartUtil.isVersion103Capable()) { String pieSectionExplode = getStringParameter(parameters, "piesectionexplode", ""); // default to no key explode String explodeList[] = pieSectionExplode.split(","); for (String anExplodeList : explodeList) { if (StringUtils.isBlank(anExplodeList)) continue; /* Should skip if trimming string is blank */ try { plot.setExplodePercent(anExplodeList.trim(), DEFAULT_PIE_EXPLODE); } catch (Exception exception) { log.debug("Ignore errors"); } } } }
pieplot.setExplodePercent(topApi, 0.20000000000000001D);
plot2.setExplodePercent("3", 0.25); plot2.setLabelGenerator(labelGenerator);
private void initPlot(PiePlot plot, int chartType) { switch (chartType) { case TYPE_FISHEYE_PIE: //orient chart so labels will align nicely even if small slices of pie are present plot.setStartAngle(180); plot.setDirection(Rotation.ANTICLOCKWISE); break; case TYPE_CRUCIBLE_PIE: plot.setStartAngle(160); plot.setDirection(Rotation.CLOCKWISE); plot.setExplodePercent("Unreviewed", .25); plot.setLabelGenerator(null); break; default: } }
plot.setExplodePercent(getKey(), getExplodedPercent());
pie.setExplodePercent( (Comparable) iter.next(), .30 );