LegendTitle legendTitle = chart.getLegend();
legendTitle.setItemFont(font);
legendTitle.setNotify(true);
The setNotify() method somehow alerts the different objects dependent on the LegentTitle and update it's state. If that is not called, nothing happens. If that method is set to true that means, the current change on the chart, specifically the LegentTitle, call all dependent objects and notify of this change and properly act on it.
That's odd. Are you using the latest version of JFreeChart? There was a bug (1749124 at SourceForge) that would cause this, but it was fixed in 2007. If you are seeing this problem in JFreeChart 1.0.13 it would be really great if you could e-mail me the steps to reproduce it.
ReplyDeleteBest regards,
Dave Gilbert
JFreeChart Project Leader
Can i Hyperlink to the legend items in a jfree pie chart.
DeleteI am using jfreechart 1.0.14
Hi David. I'm using the JFreeChart 1.0.10 version. Was this the version you are referring to that was fixed in 2007?
ReplyDeletePlease see the steps below to reproduce the issue.
1. I created a JFreeChart of type Bar Chart object using the ChartFactory.createBarChart method. Show legend set to true.
2. Set properties of chart instance.
3. Set CategoryPlot parameters.
4. Set the properties for the BarRenderer
5. Set CategoryAxis properties.
6. Set NumberAxis properties.
7. Get the LegendTitle from chart instance and set the ItemFont to a Font object that's of name MS UI Gothic, style is PLAIN of size 12.
8. Generate the image.