Hello,
I want to do an XY plot where the range on the y-axis will go from -5 to +5.
I want to 'highlight' the horizontal grid line for y == 0.
Is this possible?
Thank you,
Ted Hill
Grid Line painting
Re: Grid Line painting
Hi Ted,
Yes, it is possible. Use the
setCrosshairVisible(...)
and
setCrosshairValue(...)
methods of the com.jrefinery.chart.ValueAxis
Regards,
Andreas Schroeder
Yes, it is possible. Use the
setCrosshairVisible(...)
and
setCrosshairValue(...)
methods of the com.jrefinery.chart.ValueAxis
Regards,
Andreas Schroeder
Re: Grid Line painting
You could try the addDomainMarker(...) method in the XYPlot class. Create a marker at zero with a thick line...
Regards,
DG.
Regards,
DG.
Re: Grid Line painting
Andreas,
Thanks for the tip on cross hair.
I'm currently using 0.9.2 and there seems to be a bug:
here is my code to set the crosshair corresponding to y == 0
double horizontalCrossHair = 0;
ValueAxis yAxis = (ValueAxis) plot.getRangeAxis();
yAxis.setCrosshairValue(horizontalCrossHair);
yAxis.setCrosshairPaint(Color.red);
yAxis.setCrosshairVisible(true);
No matter what value I give horizontalCrossHair (e.g. 3, 0, -1, etc.) it always draws at y == 1.
Am I overlooking something?
Thanks,
Ted Hill
Thanks for the tip on cross hair.
I'm currently using 0.9.2 and there seems to be a bug:
here is my code to set the crosshair corresponding to y == 0
double horizontalCrossHair = 0;
ValueAxis yAxis = (ValueAxis) plot.getRangeAxis();
yAxis.setCrosshairValue(horizontalCrossHair);
yAxis.setCrosshairPaint(Color.red);
yAxis.setCrosshairVisible(true);
No matter what value I give horizontalCrossHair (e.g. 3, 0, -1, etc.) it always draws at y == 1.
Am I overlooking something?
Thanks,
Ted Hill
Re: Grid Line painting
This works:
XYPlot plot = (XYPlot)chart.getPlot();
plot.addHorizontalLine(new Integer(0), Color.red);
to draw a horizontal line at y== 0
Thanks,
Ted Hill
XYPlot plot = (XYPlot)chart.getPlot();
plot.addHorizontalLine(new Integer(0), Color.red);
to draw a horizontal line at y== 0
Thanks,
Ted Hill
Re: Grid Line painting
David,
Thanks, I downloaded 0.9.3 and am now using setRangeMarker(), works just fine.
Thank you for all your great work on this great product!
Ted Hill
Thanks, I downloaded 0.9.3 and am now using setRangeMarker(), works just fine.
Thank you for all your great work on this great product!
Ted Hill