5.5.3 ColorMapper

ColorMapper maps colors to axis colors. It can be used when there are many data elements in series, and all of them need to be colored differently, for example Bubble Series, Scatter Series and so on.

Setting ColorMapper:

1
2
3
4
5
6
// sets a new ColorMapper object, named colorMapper,
// which will paint each series using different color
ColorMapper colorMapper = new ColorMapper(DataColumnType.VALUE);
 
//sets color mapper to a series object, named lineSeries
lineSeries.setColorMapper(colorMapper);

 ColorMapper Demonstration

Figure 5.5.3 ColorMapper Demonstration

For Source code of this sample, please refer to section “4.1.1 Line Series”.

Other ColorMapper Options

Color Range

It is possible to set color range, which will be used for setting series colors.

Setting color range:

 
colorMapper.setColors(Color.RED, Color.BLUE);