Reputation: 13
I'm trying to show additional info in tooltip.
I'm using the StandardCategoryToolTipGenerator.
The original values retrieved from database are elaborated before they are associated to the CategorydataSet.
I would like to show the original value in the tooltip.. Is it possible? I only can load the {0}, {1}, {2} values, maybe there's a way to store additional info in categorydata set?
Thank you for support,
Michela
Upvotes: 1
Views: 280
Reputation: 7126
You can extend StandardCategoryItemLabelGenerator
and override generateToolTip
. With access to the dataset
, you can put pretty much anything in the tooltip. For example,
CategoryPlot plot = (CategoryPlot) chart.getPlot();
BarRenderer renderer = (BarRenderer) plot.getRenderer();
renderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator(){
@Override
protected String generateLabelString(CategoryDataset dataset, int row, int col) {
return dataset.getColumnKey(col) + " " + dataset.getValue(row, col);
}
});
Upvotes: 2