255 - ((255 - c.getBlue()) / 5)); PieDataset dataset = plot.getDataset(); int sectionCount = dataset.getItemCount(); if (colors.length < sectionCount) { // we need to interpolate some
boolean include; double v = 0.0; Number n = getDataset().getValue(key); if (n == null) { include = !getIgnoreNullValues();
boolean include = true; double v = 0.0; Number n = getDataset().getValue(key); if (n == null) { include = !getIgnoreNullValues(); g2.setFont(this.labelFont); TextUtilities.drawAlignedString(getLabelGenerator() .generateSectionLabel(getDataset(), key), g2, x, y, TextAnchor.CENTER);
/** * Initialises the drawing procedure. This method will be called before * the first item is rendered, giving the plot an opportunity to initialise * any state information it wants to maintain. * * @param g2 the graphics device. * @param plotArea the plot area ({@code null} not permitted). * @param plot the plot. * @param index the secondary index ({@code null} for primary * renderer). * @param info collects chart rendering information for return to caller. * * @return A state object (maintains state information relevant to one * chart drawing). */ public PiePlotState initialise(Graphics2D g2, Rectangle2D plotArea, PiePlot plot, Integer index, PlotRenderingInfo info) { PiePlotState state = new PiePlotState(info); state.setPassesRequired(2); if (this.dataset != null) { state.setTotal(DatasetUtils.calculatePieDatasetTotal( plot.getDataset())); } state.setLatestAngle(plot.getStartAngle()); return state; }
/** * Handle color customization requested. * - get customization parameters from parameter Map and modify plot accordingly * @param parameters macro parameters * @param plot chart plot * @throws MacroExecutionException */ void handleColorCustomization(Map parameters, Plot plot) throws MacroExecutionException { String colors = (String) parameters.get("colors"); if (colors != null) { String[] color = colors.split(","); for (int i = 0; i < color.length; i++) { if (plot instanceof CategoryPlot) { ((CategoryPlot) plot).getRenderer().setSeriesPaint(i, stringToColor(color[i])); } else if (plot instanceof XYPlot) { ((XYPlot) plot).getRenderer().setSeriesPaint(i, stringToColor(color[i])); } else if (plot instanceof PiePlot) { PiePlot piePlot = (PiePlot)plot; PieDataset pieDataset = piePlot.getDataset(); if (i < pieDataset.getItemCount()) piePlot.setSectionPaint(pieDataset.getKey(i), stringToColor(color[i])); } } } }
/** * Initialises the drawing procedure. This method will be called before * the first item is rendered, giving the plot an opportunity to initialise * any state information it wants to maintain. * * @param g2 the graphics device. * @param plotArea the plot area (<code>null</code> not permitted). * @param plot the plot. * @param index the secondary index (<code>null</code> for primary * renderer). * @param info collects chart rendering information for return to caller. * * @return A state object (maintains state information relevant to one * chart drawing). */ public PiePlotState initialise(Graphics2D g2, Rectangle2D plotArea, PiePlot plot, Integer index, PlotRenderingInfo info) { PiePlotState state = new PiePlotState(info); state.setPassesRequired(2); if (this.dataset != null) { state.setTotal(DatasetUtilities.calculatePieDatasetTotal( plot.getDataset())); } state.setLatestAngle(plot.getStartAngle()); return state; }
PieDataset dataset = plot.getDataset(); for (int i = 0; i < dataset.getItemCount(); i++) { String key = (String) dataset.getKey(i);
false, // line not visible new Line2D.Float(), new BasicStroke(), Color.BLACK); item.setDataset(getDataset()); item.setSeriesIndex(this.dataset.getIndex(key)); item.setSeriesKey(key);
false, // line not visible new Line2D.Float(), new BasicStroke(), Color.black); item.setDataset(getDataset()); item.setSeriesIndex(this.dataset.getIndex(key)); item.setSeriesKey(key);