Hi
i am having problems in changing the title to my chart. I am working at a multi-language module and i need to update the titles according to new language. I tried in many ways to change the titles but i had no success...
The JFreeChart Object is created in the init method in this way:
jfreechart = ChartFactory.createTimeSeriesChart(header_graphic, caption_x, caption_y, dataset, true);
ChartPanel chartpanel = new ChartPanel(jfreechart);
graphic.add(chartpanel);
The attempted title change is made in this way:
Vector vec = new Vector(1);
TextTitle revised = new TextTitle("Ciao...");
vec.addElement(revised);
java.util.List titleList = (java.util.List)vec;
jfreechart.setTitles(titleList);
frm_main.f_m.paintAll(frm_main.f_m.getGraphics());
But i did not see any changes. The title remains the same
What is my error?
Thanks for your help
neri
Changing titles
Re: Changing titles
Hi Neri,
I think I've got this cleaned up a bit for the next release, where there will be a single main title, with getTitle() and setTitle() methods, then a list of subtitles which will be empty by default but you can add to the list if you want to.
But for 0.9.4, there is just this title list. Assuming you have one title in your chart, you should be able to access it like this:
TextTitle title = (TextTitle) myChart.getTitle(0);
title.setText("Hello World");
Regards,
Dave Gilbert
I think I've got this cleaned up a bit for the next release, where there will be a single main title, with getTitle() and setTitle() methods, then a list of subtitles which will be empty by default but you can add to the list if you want to.
But for 0.9.4, there is just this title list. Assuming you have one title in your chart, you should be able to access it like this:
TextTitle title = (TextTitle) myChart.getTitle(0);
title.setText("Hello World");
Regards,
Dave Gilbert