Reputation: 1459
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).
Upvotes: 0
Views: 1037
Reputation: 1459
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
Upvotes: 1