JFreechart LookUpPaintScale颜色渐变

时间:2011-06-27 20:43:49

标签: gradient scale jfreechart lookup paint

如何在JFreechart中向LookUpPaintScale添加颜色渐变(3种颜色:红色,黄色,绿色)? 感谢

2 个答案:

答案 0 :(得分:1)

  

我尝试使用新的GradientPaint初始化它,但这只需要2种颜色。

您可以尝试LinearGradientPaint

答案 1 :(得分:1)

你可以尝试这样的事情

....

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);

....