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.
Range Markers on Line Charts
Re: Range Markers on Line Charts
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
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
Re: Range Markers on Line Charts
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.
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.
Re: Range Markers on Line Charts
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
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
Re: Range Markers on Line Charts
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
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