Can't find a matching example

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
willkoky
Posts: 5
Joined: Tue Feb 28, 2012 9:46 pm
antibot: No, of course not.

Can't find a matching example

Post by willkoky » Tue Feb 28, 2012 9:59 pm

Hello,
I have a user requesting a chart that tells them when someone filled their medication, how long that filling lasted. They gave me a picture of a horizontal line chart with y value categories drug 1, 2, 3 and dates as the X axis. For each drug, a diamond appears at the date of a filling followed by a bar from that filling date to date that the filling's supply would provide, you get 10 pills of Drug 1 on 1/1/11 you would have a diamond on the row of Drug 1 at 1/1 and a line that goes on the row of Drug 1 from 1/1 until 1/11. Thus if the next diamond (filling) does not come before the line ends, they know a patient could not have taken their medication each day they were supposed to.

Does anyone have any suggestions on how JFreeChart can be used to implement a graph that looks like that? The stumbling blocks seem to be drawing a chart that has lines that end without points and that there are categories with multiple dates and a magnitude of each filling in each category. Instead of just a simple date.

The closest thing from the examples I can describe is a categorized Wind Chart with a backwards arrow. :)

Thank you for any help, willkoky

matinh
Posts: 483
Joined: Fri Aug 11, 2006 10:08 am
Location: Austria

Re: Can't find a matching example

Post by matinh » Wed Feb 29, 2012 8:31 am

Hi!

What came to my mind is an IntervalCategoryDataset with an IntervalBarRenderer. Maybe you could provide a mock-chart for us, so it would be easier so see your complete needs.

hth,
- martin

willkoky
Posts: 5
Joined: Tue Feb 28, 2012 9:46 pm
antibot: No, of course not.

Re: Can't find a matching example

Post by willkoky » Wed Feb 29, 2012 2:42 pm

Here's the picture, I should have attached it to start with. Sorry.
Image
I did have a thought. Can I take the XYBarChartDemo7 and create a new image for the bar? Make the bar be very thin and have it start with a large diamond? I don't know how to change the bar but I'm sure its in the manual somewhere. Thanks.

Image does not appear so here is link
https://picasaweb.google.com/lh/photo/Q ... directlink
https://picasaweb.google.com/lh/photo/Q ... directlink

matinh
Posts: 483
Joined: Fri Aug 11, 2006 10:08 am
Location: Austria

Re: Can't find a matching example

Post by matinh » Wed Feb 29, 2012 3:08 pm

I'd try it with two different renderers in one plot, just like in OverlaidBarChartDemo1.

First try to create a chart which shows the bars suitable for your needs.
Then use a second renderer (like the XYLineAndShapeRenderer) either for the same dataset or for a similar dataset that only renders the diamonds or whatever symbol you like.

hth,
- martin

willkoky
Posts: 5
Joined: Tue Feb 28, 2012 9:46 pm
antibot: No, of course not.

Re: Can't find a matching example

Post by willkoky » Thu Mar 01, 2012 7:49 pm

Thank you very much Martin, this approach is working perfectly so far. XYBarChartDemo7 with a second XYLineAndShapeRenderer, lines turned off, running the same data set.

Locked