Series trend lines on bar chart with Category Dataset

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
nst197
Posts: 1
Joined: Wed Feb 15, 2017 11:59 am
antibot: No, of course not.

Series trend lines on bar chart with Category Dataset

Post by nst197 » Wed Feb 15, 2017 1:06 pm

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,

Neville

paradoxoff
Posts: 1634
Joined: Sat Feb 17, 2007 1:51 pm

Re: Series trend lines on bar chart with Category Dataset

Post by paradoxoff » Thu Feb 16, 2017 1:06 pm

You might be better off by stuffing the data into a separate CategoryDataset and render that with a LineAndShapeRenderer.

Locked