【发布时间】:2012-08-15 00:58:12
【问题描述】:
在JFreeChart 中,我正在尝试根据y 值对XY 折线图/曲线的不同区域进行着色。我正在覆盖XYLineAndShapeRenderer 的getItemPaint(int row, int col),但是我不确定它如何处理xs 之间的线的着色,因为它只在x 上获得itemPaint(整数值) .
final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer() {
@Override
@Override
public Paint getItemPaint(int row, int col) {
System.out.println(col+","+dataset.getY(row, col));
double y=dataset.getYValue(row, col);
if(y<=3)return ColorUtil.hex2Rgb("#7DD2F7");
if(y<=4)return ColorUtil.hex2Rgb("#9BCB3B");
if(y<=5)return ColorUtil.hex2Rgb("#FFF100");
if(y<=6)return ColorUtil.hex2Rgb("#FAA419");
if(y<=10)return ColorUtil.hex2Rgb("#ED1B24");
//getPlot().getDataset(col).
return super.getItemPaint(row,col);
}
}
【问题讨论】:
标签: java jfreechart renderer