如何在jfreechart中国际化日期值?

时间:2013-07-04 16:36:38

标签: java jfreechart

任何人都可以告诉我们如何将jfreechart中的日期值国际化(2013年6月30日至2013年6月30日)。

感谢。

2 个答案:

答案 0 :(得分:1)

如果所需的Locale不是您的默认Locale,则可以从Supported Locales中明确指定:

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

在分发中的TimeSeriesChartDemo1included中进行了测试。另请参阅与DateFormatSymbols相关的answer

答案 1 :(得分:0)

要仅更改语言(并保留JFreechart的动态格式),请使用setLocale代替setDateFormatOverride

            DateAxis axis = (DateAxis) plot.getDomainAxis();
            axis.setLocale(new Locale("es", "ES"));