I'm using SpiderWebPlot from JFreeChart in order to generate a chart. But what I want to have, is tooltips with values. I've found that I should set StandardCategoryTooltipGenerator to the plot, but that doesn't seem to be the point. Here is my sample code:
private JFreeChart prepareChart() {
Random rnd = new java.util.Random();
DefaultCategoryDataset dataSet = new DefaultCategoryDataset();
String rowKey = "Osobnik";
dataSet.addValue(rnd.nextInt(20), rowKey, "BLUFF");
dataSet.addValue(rnd.nextInt(20), rowKey, "CALL");
dataSet.addValue(rnd.nextInt(20), rowKey, "CHECK");
dataSet.addValue(rnd.nextInt(20), rowKey, "FOLD");
dataSet.addValue(rnd.nextInt(20), rowKey, "RAISE");
SpiderWebPlot plot = new SpiderWebPlot(dataSet);
// CategoryToolTipGenerator generator = new
// StandardCategoryToolTipGenerator();
// generator.generateToolTip(dataSet, 0, 1);
plot.setToolTipGenerator(new StandardCategoryToolTipGenerator());
plot.setStartAngle(54D);
plot.setInteriorGap(0.40000000000000002D);
plot.setToolTipGenerator(new StandardCategoryToolTipGenerator());
JFreeChart chart = new JFreeChart(plot);
return chart;
}
Here is the example of what I'm trying to accomplish.
ChartPanel
"registers with the chart to receive notification of changes to any component of the chart." I suspect you have neglected to construct aChartPanel
; given astatic
version ofprepareChart()
, the followingmain()
works for me. See also Initial Threads.Addendum: Based on the posted screenshots, you'll need a custom
CategoryItemLabelGenerator
, which can be set usingsetLabelGenerator()
. It will be called fromdrawLabel()
, shown here. For example,