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
Need extra information in dataset
-
- 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
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.
(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
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader

