I have an XY plot in which calling setDrawSeriesLineAsPath(true) on the
renderer causes the whole line to disappear; things work as expected
otherwise. I do not have the time to go to the bottom of this new oddity
right now but perhaps it rings a bell with someone? Thanks.
setDrawSeriesLineAsPath(true) causes lines to disappear
Re: setDrawSeriesLineAsPath(true) causes lines to disappear
Which version of JFreeChart are you using? There was a problem in the initial versions where this happened but it should be fixed now.
I cannot remember on the top of my head the broken version nor where it started to work. You should be able to find similar threads with the Search, though...
I cannot remember on the top of my head the broken version nor where it started to work. You should be able to find similar threads with the Search, though...
Re: setDrawSeriesLineAsPath(true) causes lines to disappear
No, I am using the latest version and of course I already searched this forum. So I digged
and I found that when drawSeriesLineAsPath is set, the drawItem method of the renderer
calls drawPrimaryLineAsPath, which only draws the path once the item index reaches
state.getLastItemIndex(). The problem is that the method is not called if the item is not
visible and that it can perfectly well happen that the last item is not visible, in which case
the path (i.e., the whole line) is never drawn! How to fix this depends on the particulars
of your data but is not difficult. I strongly feel this is a bug, though.
There is a very similar issue with legends, by the way: for no particular reason that I could
find XYLineAndShapeRenderer, unlike XYShapeRenderer, excludes from the legend any series
whose first point is not visible, which can also happen. Also a bug in my opinion.
At least these gotchas should be clearly signposted in the Javadocs or in the documentation.
and I found that when drawSeriesLineAsPath is set, the drawItem method of the renderer
calls drawPrimaryLineAsPath, which only draws the path once the item index reaches
state.getLastItemIndex(). The problem is that the method is not called if the item is not
visible and that it can perfectly well happen that the last item is not visible, in which case
the path (i.e., the whole line) is never drawn! How to fix this depends on the particulars
of your data but is not difficult. I strongly feel this is a bug, though.
There is a very similar issue with legends, by the way: for no particular reason that I could
find XYLineAndShapeRenderer, unlike XYShapeRenderer, excludes from the legend any series
whose first point is not visible, which can also happen. Also a bug in my opinion.
At least these gotchas should be clearly signposted in the Javadocs or in the documentation.