2

Can any one please tell how to internationalize the date value in jfreechart like (30 Jun 2013 to 30 junio 2013).

Thanks.

Jack
  • 155
  • 1
  • 1
  • 6
  • 1
    What's your default `Locale`? Did you specify a suitable `Locale` in your `DateFormat`? Please edit your question to include an [sscce](http://sscce.org/) that exhibits the problem you describe. – trashgod Jul 04 '13 at 19:02

2 Answers2

1

If the desired Locale is not your default Locale, you can specify it explicitly from among the Supported Locales:

DateAxis axis = (DateAxis) plot.getDomainAxis();
axis.setDateFormatOverride(new SimpleDateFormat("dd-MMM-yyyy", new Locale("es", "ES")));

Tested in TimeSeriesChartDemo1, included in the distribution. See also this related answer regarding DateFormatSymbols.

trashgod
  • 203,806
  • 29
  • 246
  • 1,045
  • Thanks dude. But my req is something different. – Jack Jul 05 '13 at 12:29
  • See thie example http://www.java2s.com/Code/Java/Chart/JFreeChartTimePeriodValuesDemo2.htm . I want to show the Russian lang. How to do this one? – Jack Jul 05 '13 at 12:29
  • Hello trash, Thanks for your above tip. It solves my problem. Thanks again. – Jack Jul 05 '13 at 13:39
0

To change only the language (and keep dynamic format from JFreechart) use setLocale instead of setDateFormatOverride :

            DateAxis axis = (DateAxis) plot.getDomainAxis();
            axis.setLocale(new Locale("es", "ES"));
Cedric Simon
  • 4,571
  • 4
  • 40
  • 52