Customize colors of steps in Step chart with one data series

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
skyhook
Posts: 8
Joined: Tue Mar 03, 2015 2:34 pm
antibot: No, of course not.

Customize colors of steps in Step chart with one data series

Post by skyhook » Wed Mar 04, 2015 9:54 am

Hi,

Its possible to customize colors of each steps in StepArea chart? I was trying to do something like this:

@Override
public Paint getItemPaint(int series, int item) {
XYDataset dataset = getPlot().getDataset();

if (dataset.getYValue(series, item) == 0) {
paint = Color.black;
}

if (dataset.getYValue(series, item) == 1) {
paint = Color.red;
}
...

but when i have only one data series in collection, only one color remaining. I have daily data with frequency 10s, values 0,1,2,3, for y-axis, and time on x-axis and i need create something like step area chart or one bar which changing color between each points on x-axis according y value.


Locked