use of org.jfree.chart.PaintMap in project processdash by dtuma.
the class StandardDiscItemRenderer method setPaintKeyMapper.
/**
* Install an object that maps data keys to paint keys
* @since 2.2.1
*/
public void setPaintKeyMapper(PaintKeyMapper paintKeyMapper) {
this.paintKeyMapper = paintKeyMapper;
this.discPaintMap = new PaintMap();
DrawingSupplier ds = getDrawingSupplier();
if (paintKeyMapper != null && ds != null) {
try {
Collection<Comparable> keys = paintKeyMapper.getAllPaintKeys();
Paint bg = plot.getBackgroundPaint();
for (Comparable oneKey : new TreeSet<Comparable>(keys)) {
Paint onePaint = ds.getNextPaint();
if (onePaint instanceof Color && bg instanceof Color)
onePaint = PaintUtils.adjustForContrast((Color) onePaint, (Color) bg);
this.discPaintMap.put(oneKey, onePaint);
}
} catch (Throwable t) {
// the "getAllPaintKeys" method was added in PD 2.3. If a
// particular implementor doesn't support it yet, catch the
// error and continue without preassigning colors.
}
}
}
Aggregations