Problem Chart timeline with REPORT_LOCALE
Brought to you by:
djmamana,
martingoros
Hi,
I'm using DynamicJasper 4.0.3 and JasperReport 5.2.0. I use Java 7.
I use DynamicJasper to make a dynamics table and chart (timeline) in a PDF report. All my table and chart are coded in JAVA.
The problem is that my chart doesn't take the REPORT_LOCALE to change the language of the months on the X axis. It seems to take always the JVM LOCALE. But I want the chart takes the current locale of my site.
Here is how I create my report:
HashMap parameters = new HashMap();
parameters.put("REPORT_LOCALE", locale);//Locale.ENGLISH or Locale.FRENCH
DynamicReport dr = buildReport();
JRDataSource ds = new JRBeanCollectionDataSource(data);
JasperReport report = DynamicJasperHelper.generateJasperReport(dr, new ClassicLayoutManager(), parameters);
JasperPrint jasperPrint = JasperFillManager.fillReport(report, parameters, ds);
byte[] output = JasperExportManager.exportReportToPdf(jasperPrint);
The chart is built with a DJTimeSeriesChartBuilder:
DJTimeSeriesChartBuilder djChart = new DJTimeSeriesChartBuilder();
DJAxisFormat timeAxisFormat = new DJAxisFormat("Months");
timeAxisFormat.setTickLabelMask("MM");
...
djChart.setTimeAxisFormat(timeAxisFormat);
...