Series trend lines on bar chart with Category Dataset

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
licondam
Posts: 1
Joined: Wed Mar 27, 2019 10:02 am
antibot: No, of course not.

Series trend lines on bar chart with Category Dataset

Post by licondam » Wed Mar 27, 2019 10:05 am

Hi Everyone,

I've only recently started using Jfreechart and this is my first time on the forums so apologies in advance if I'm asking newbie questions.

I've looked all over the forum and the web but can't find an answer to my issue which is......

I'm trying to add trend lines to a category bar chart that has three data series on it. I've found some code from someone trying to do something similar and using that I've got to the point where I can draw three lines which track the data points for each series. To achieve that I'm using the CatagoryLineAnnotation class.

The issue I've got is that the CategoryLineAnnotation class only lets you add the line to the Categories rather than each dataset series, which means the data points for all three trend lines line up with the middle bar in each category, rather than being positioned above their corresponding bar. Can anyone point me in right direction to fix this? Is it possible to offset the annotations somehow, or potentially draw them on another plot and offset that?

Thanks

John Matthews
Posts: 513
Joined: Wed Sep 12, 2007 3:18 pm

Re: Series trend lines on bar chart with Category Dataset

Post by John Matthews » Fri Mar 29, 2019 1:16 am

Maybe something like OverlaidBarChartDemo1?

Locked