JFreechart LookUpPaintScale color gradient
How do you ad开发者_StackOverflow社区d a color gradient (3 colors: red, yellow, Green) to a LookUpPaintScale
in JFreechart?
Thanks
I tried initializing it with the new
GradientPaint
, but this only take 2 colors.
You could try LinearGradientPaint
.
you can try something like this
....
XYPlot plot = new XYPlot(data1, xAxis, yAxis, null);
LookupPaintScale ps = new LookupPaintScale(0,101,Color.lightGray);
ps.add(0, Color.green);
ps.add(10, Color.yellow);
ps.add(20, Color.red);
renderer1.setBlockHeight(0.95f);
renderer1.setBlockWidth(0.95f);
renderer1.setPaintScale(ps);
plot.setRenderer(renderer1);
....
精彩评论