Need extra information in dataset

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
dorseywright
Posts: 4
Joined: Tue Feb 05, 2008 5:41 pm

Need extra information in dataset

Post by dorseywright » Wed Mar 25, 2009 4:47 pm

Hi, I'm trying to create a scatter plot, but I noticed that the dataset only lets me specify x,y values along with a label for the entire series. However, I'd like to also include additional information in a mouseover. I understand how to manipulate the tooltips, but I'm not sure how to add something other than what is currently in the data set. Any help would be greatly appreciated.

Chuck

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Re: Need extra information in dataset

Post by david.gilbert » Wed Mar 25, 2009 4:51 pm

You have two options:

(1) Write your own class that implements the XYDataset interface and add the data structures and getter/setter methods you need to store the additional information for the tooltips;

(2) Store the additional data for your tooltips in a lookup table independently of the dataset, but linked by the series key and item index.

Both cases are going to require a custom tool tip generator class. Option (2) is probably not as nice, because you run the risk of your two data stores getting out of sync.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

Locked