开发者

Filling in the Area between of two lines which intersect?

开发者_JAVA技巧Is it possible to fill in the area between a Dataset plotting a XY line and a ValueMarker ? See picture for the general idea(Warning: My MS Paint skills are lacking).

Filling in the Area between of two lines which intersect?


As lschin, XYDifferenceRenderer is the best way to do this. In order to have this work you need to create two separate multidimensional double arrays to store to X and Y coordinates. The first array is set to store your a XY line's x and y coor's. The second array is a constant XY line. To set this line up you X values are the same. If your original line is above your constant line, the Y value is the coordinate you choose of position of the constant line. If the original is below the constant then the Y value of the constant is that of your original line. I hope that makes sense and is helpful to anyone, ive attached code below for better understanding.

setConstant = position of your constant line. The code below is placed in a loop:

indLine[0][i]= XYIndLine.getXValue(1, i);
indLine[1][i] = XYIndLine.getYValue(1, i);
constant[0][i] = XYIndLine.getXValue(1, i);
constant[1][i] = Math.min(setConstant, XYIndLine.getYValue);

once this is done then use addSeries to add the two arrays to a DefaultXYDataset

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜