Adding Marker on LineChart

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

Adding Marker on LineChart

Post by Suprigya » Tue Dec 10, 2002 11:01 pm

Hi,

I want to display a horizontal solid line on my LineChart. To do that, I added Marker, but the line gets always displayed as dashed and it's very thin, how can I make it a solid line and little thicker? I tried changing width of BasicStroke object, but that does change anything.

plot.addRangeMarker( new Marker( value, Color.red,
new BasicStroke(3.0f), Color.red, 1.0f ) );

Also, is there a way to display the value of this Marker of the chart on y-axis?

Thanks.

Suprigya

Re: Adding Marker on LineChart

Post by Suprigya » Thu Dec 12, 2002 9:06 pm

Thanks, I fixed it. The problem was happening because I was using LineAndShapeRenderer for the plot. The drawRangeMarker method of renderer does not use stroke set on the marker object. So, I created a class extending LineAndShapeRenderer. This overrides the drawRangeMarker method, allowing graphic object to use stroke set on the marker.

Locked