/** * Sets the color for dataset (ordered on index) * @param plot * @param dataset */ @SuppressWarnings("rawtypes") public void setColor(PiePlot plot, DefaultPieDataset dataset) { @SuppressWarnings("unchecked") List<Comparable> keys = dataset.getKeys(); for (int i = 0; i < keys.size(); i++) { plot.setSectionPaint(keys.get(i), this.color[i]); } } }
static class PieRenderer { private Color[] color; public PieRenderer(Color[] color) { this.color = color; } public void setColor(PiePlot plot, DefaultPieDataset dataset) { List <Comparable> keys = dataset.getKeys(); int aInt; for (int i = 0; i < keys.size(); i++) { aInt = i % this.color.length; plot.setSectionPaint(keys.get(i), this.color[aInt]); } } }
int currItem = 1; Number othersValues = Integer.valueOf(0); List<Comparable> keys = dataSet.getKeys(); for(Comparable key : keys) { Number existingValue = dataSet.getValue(key);