Drawing a horizontal line in a plot

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Christophe Franco

Drawing a horizontal line in a plot

Post by Christophe Franco » Tue Mar 04, 2003 3:22 pm

I'm looking for a way to draw a horizontal line at a given ordinate value. Something like a custom tick on the Y axis, but with a custom line shape and label (nothing very complicated, just need to set the line width and color, and to have a plain line rather than dashed)

I don't want to work around this with a XYSeries with 2 points at the same Y value, because the line needs to be infinite.

Therefore I thought of a custom axis tick, but couldn't find an easy way to do it. Is there any ?

Thank you everyone in advance,

Christophe

David Gilbert

Re: Drawing a horizontal line in a plot

Post by David Gilbert » Tue Mar 04, 2003 6:08 pm

You don't need to put the values into your dataset. Just use the addRangeMarker(...) method in the plot.

Regards,

Dave Gilbert

Christophe Franco

Re: Drawing a horizontal line in a plot

Post by Christophe Franco » Tue Mar 04, 2003 6:38 pm

Thanks you a lot. Just a little precision please, what does the "paint" parameter refer to in the constructor :

public Marker(double value, Paint outlinePaint, Stroke outlineStroke, Paint paint, float alpha)

I understand the outlinePaint is for the color of the line, but the "paint" ?

Tim

Re: Drawing a horizontal line in a plot

Post by Tim » Wed Mar 05, 2003 9:09 pm

I don't know the exact definition, but if you draw a line on a 3-D graph, it will be the color of the surface (or the 'filled in' color if you prefer).

Locked