Range Markers on Line Charts

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

Range Markers on Line Charts

Post by James » Sun Jan 12, 2003 2:20 pm

Hi,

I'm trying to add a range marker in a line chart but it doesn't seem to work. If I switch to column charts or bar charts however, it works fine. Here's the line I'm using.

CategoryPlot categoryPlot = chart.getCategoryPlot();

categoryPlot.addRangeMarker(new Marker(20, Color.GRAY, new BasicStroke(3.0f), Color.GRAY, 1.0f));

As I said in the beginning, if I use the same code and CategoryDataset to build a bar chart or column chart instead, the marker gets displayed as expected.

I'm using JFreeChart 0.9.3 with JCommon 0.7.0.

Thanks for any answers.

James.

David Gilbert

Re: Range Markers on Line Charts

Post by David Gilbert » Mon Jan 13, 2003 4:51 pm

Hi James,

It sounds like a bug in that version. I've checked the CVS version, and it is working there, so the bug must have been fixed at some point. Did you try 0.9.4?

Regards,

Dave Gilbert

James

Re: Range Markers on Line Charts

Post by James » Tue Jan 14, 2003 10:05 am

Hi Dave,

I did try 0.9.4 some time ago but the problem I found with it is that it's no longer painting shapes at the datapoints in my line chart. At the time I remember reading in the javadocs and setting shape factories and trying several things but it wouldn't work. I no longer have the code I was using so I can't paste a sample. Is that a bug in 0.9.4 ?

James.

David Gilbert

Re: Range Markers on Line Charts

Post by David Gilbert » Wed Jan 15, 2003 11:11 am

Hi James,

I think it is just the default settings in the renderer that changed. I've made some changes for 0.9.5 so that you can change renderer attributes "on-the-fly" so that it should be easier to customise the chart appearance (in that you don't have to create a whole new renderer).

Regards,

Dave Gilbert

Paolo

Re: Range Markers on Line Charts

Post by Paolo » Fri Jan 17, 2003 11:31 pm

I found the following in AbstractXYItemRenderer, line 284-5:

Stroke stroke = marker.getOutlineStroke();
g2.setStroke(stroke == null ? stroke : Plot.DEFAULT_OUTLINE_STROKE);

So even if you set the stroke, Plot.DEFAULT_OUTLINE_STROKE is used. That == should be a !=

Paolo

Locked