Is there a way to get the horizontal line at vertical position 0 to be drawn thicker than the other horizontal lines.
Or alternatively have the negative part of the y-axis be drawn in another color (i.e. red)?
Rgds,
Tom
Thicker horizonal line at vertical position 0
RE: Thicker horizonal line at vertical position 0
Hi Tom,
You would need to modify the draw method in the Plot class (actually, whatever subclass of Plot you need this in). I'll have a think about defining another attribute for defining the Stroke to use for drawing the zero lines...
Regards,
DG.
You would need to modify the draw method in the Plot class (actually, whatever subclass of Plot you need this in). I'll have a think about defining another attribute for defining the Stroke to use for drawing the zero lines...
Regards,
DG.
RE: Thicker horizonal line at vertical position 0
I've implemented your suggestion. I actually added some code to the draw method of the VerticalNumberAxes for drawing the gridline at the 0-tick differently.
It would be a cool addition to have a setGridStrokeZero() and setGridPaintZero() methods that are taken into account when drawing the gridlines.
BTW: Another user suggested to use the addHorizontalLine() and addVerticalLine() methods of the XYPlot. This works, but (a) those line start and end points are not where I assumed they should be and (b) the horizontal line was a pixel or so above the grid line at tick 0. I had to change the drawHorizontalLines() method in XYPlot from
g2.drawLine(0,
(int)getVerticalValueAxis().translatedValue((Number)horizontalLines.get(i), plotArea),
(int)(plotArea.getWidth()),
(int)getVerticalValueAxis().translatedValue((Number)horizontalLines.get(i), plotArea));
to
Line2D line = new Line2D.Double(plotArea.getX(),
getVerticalValueAxis().translatedValue((Number)horizontalLines.get(i), plotArea),
plotArea.getMaxX(),
getVerticalValueAxis().translatedValue((Number)horizontalLines.get(i), plotArea));
g2.draw(line);
which is eqivalent to the code for drawing the grid lines. was that some error in the code or did I misunderstand something?
Regards,
Tom
It would be a cool addition to have a setGridStrokeZero() and setGridPaintZero() methods that are taken into account when drawing the gridlines.
BTW: Another user suggested to use the addHorizontalLine() and addVerticalLine() methods of the XYPlot. This works, but (a) those line start and end points are not where I assumed they should be and (b) the horizontal line was a pixel or so above the grid line at tick 0. I had to change the drawHorizontalLines() method in XYPlot from
g2.drawLine(0,
(int)getVerticalValueAxis().translatedValue((Number)horizontalLines.get(i), plotArea),
(int)(plotArea.getWidth()),
(int)getVerticalValueAxis().translatedValue((Number)horizontalLines.get(i), plotArea));
to
Line2D line = new Line2D.Double(plotArea.getX(),
getVerticalValueAxis().translatedValue((Number)horizontalLines.get(i), plotArea),
plotArea.getMaxX(),
getVerticalValueAxis().translatedValue((Number)horizontalLines.get(i), plotArea));
g2.draw(line);
which is eqivalent to the code for drawing the grid lines. was that some error in the code or did I misunderstand something?
Regards,
Tom