/** * Returns a key for the specified section. If there is no such section * in the dataset, we generate a key. This is to provide some backward * compatibility for the (now deprecated) methods that get/set attributes * based on section indices. The preferred way of doing this now is to * link the attributes directly to the section key (there are new methods * for this, starting from version 1.0.3). * * @param section the section index. * * @return The key. * * @since 1.0.3 */ protected Comparable getSectionKey(int section) { Comparable key = null; if (this.dataset != null) { if (section >= 0 && section < this.dataset.getItemCount()) { key = this.dataset.getKey(section); } } if (key == null) { key = new Integer(section); } return key; }
/** * Returns a key for the specified section. If there is no such section * in the dataset, we generate a key. This is to provide some backward * compatibility for the (now deprecated) methods that get/set attributes * based on section indices. The preferred way of doing this now is to * link the attributes directly to the section key (there are new methods * for this, starting from version 1.0.3). * * @param section the section index. * * @return The key. * * @since 1.0.3 */ protected Comparable getSectionKey(int section) { Comparable key = null; if (this.dataset != null) { if (section >= 0 && section < this.dataset.getItemCount()) { key = this.dataset.getKey(section); } } if (key == null) { key = new Integer(section); } return key; }
private static void setSectionColor(PieDataset dataset, PiePlot plot, int section, Color outline, Color paint ) { try { Comparable key = dataset.getKey(section); plot.setSectionOutlinePaint(key, outline); plot.setSectionPaint(key, paint); } catch (IndexOutOfBoundsException ie) { // This item hasn't been created, in the dataset so we skip it and don't set its colours // No further action is currently required in this case. } } }
Comparable k2 = that.getKey(i); if (!k1.equals(k2)) { return false;
Comparable k2 = that.getKey(i); if (!k1.equals(k2)) { return false;
Comparable k2 = that.getKey(i); if (!k1.equals(k2)) { return false;
Comparable k2 = that.getKey(i); if (!k1.equals(k2)) { return false;
/** * 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])); } } } }
double mep = getMaximumExplodePercent(); if (mep > 0.0) { ep = getExplodePercent(dataset.getKey(section)) / mep;
Comparable key = piedataset.getKey(i); Paint p; if (key.equals(this.aggregatedItemsKey)) {
Comparable key = piedataset.getKey(i); Paint p; if (key.equals(this.aggregatedItemsKey)) {
PieDataset dataset = plot.getDataset(); for (int i = 0; i < dataset.getItemCount(); i++) { String key = (String) dataset.getKey(i); plot.setSectionPaint(key, seriesColorsByName.get(key));
Comparable key = piedataset.getKey(i); Paint p; if(key.equals(getAggregatedItemsKey()))
plot.setSectionPaint(dataset.getKey(j), ChartDefaults.darkColors[j]);
plot.setSectionPaint(dataset.getKey(j), ChartDefaults.darkColors[j]);