Hello,
I spent quite a long time trying to create a chart which mix Interval Bar Chart and Layered Bar Chart.
I would like to use an IntervalCategoryDataset with a LayeredBarRenderer but it doesn't work (my interval bars on the chart always start at 0).
For the moment, I use an IntervalCategoryDataset and the IntervalBarRenderer like the following image. But I would like just one bar which groups the bars for one category.
Is there any solution to use the layeredRenderer with an intervalCategoryDataSet ?
thanks
Mix between Interval and Layered Bar Chart
Re: Mix between Interval and Layered Bar Chart
Hello,
I know that this post is quite old, but I've got exactly the same need than CAU.
Does anyone has a fresh answer for this question?
thank you,
I know that this post is quite old, but I've got exactly the same need than CAU.
Does anyone has a fresh answer for this question?
thank you,
Re: Mix between Interval and Layered Bar Chart
I answer to my own question, since it may be useful for another errant. I managed to do a mix between a LayeredBarRenderer and an IntervalBarRenderer. I wrote a subclass of IntervalBarRenderer and redefined/override the methods
and
in order to superpose the interval bars.
Ones who want to see what to write in these methods, can upload the jfreechart source code for LayeredBarRenderer and IntervalBarRenderer and try do a mix of these two classes.
Code: Select all
protected void drawInterval(Graphics2D g2,
CategoryItemRendererState state,
Rectangle2D dataArea,
CategoryPlot plot,
CategoryAxis domainAxis,
ValueAxis rangeAxis,
IntervalCategoryDataset dataset,
int row,
int column)
Code: Select all
protected void calculateBarWidth(CategoryPlot plot,
Rectangle2D dataArea,
int rendererIndex,
CategoryItemRendererState state)
Ones who want to see what to write in these methods, can upload the jfreechart source code for LayeredBarRenderer and IntervalBarRenderer and try do a mix of these two classes.