Jack
Jack

Reputation: 155

How to internationalize the date value in jfreechart?

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

Thanks.

Upvotes: 2

Views: 656

Answers (2)

Cedric Simon
Cedric Simon

Reputation: 4659

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"));

Upvotes: 0

trashgod
trashgod

Reputation: 205785

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.

Upvotes: 1

Related Questions