Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
How to change type for X-Axis BIRT 2.2.1.1 ?
lazarel
Hi,
I've a report with a chart with 3 axes but X-axis with object of type DateTime. In my web application people can choose between French and English localization, so I want to apply the following format for DateTime object:
1. English - "hh:mm aa"
2. French - "HH:mm"
But, I don't know how change the type dynamically. Any people how do?
Best regards,
Julien
Find more posts tagged with
Comments
lazarel
Ok I do.<br />
<br />
Script <strong class='bbc'>initialize</strong><br />
var locale = reportContext.getLocale();<br />
<br />
Script <strong class='bbc'>onRender</strong><br />
/* Called before generation of chart model to GeneratedChartState.<br />
* <br />
*
@param
chart<br />
* Chart<br />
*
@param
icsc<br />
* IChartScriptContext<br />
*/<br />
function beforeGeneration(chart, icsc)<br />
{<br />
importPackage( Packages.org.eclipse.birt.chart.model.attribute.impl );<br />
importPackage( Packages.org.eclipse.birt.chart.model.data.impl );<br />
<br />
xAxis = chart.getBaseAxes()[0];<br />
if (locale == "fr"){<br />
xAxis.setFormatSpecifier( JavaDateFormatSpecifierImpl.create("HH:mm"));<br />
}<br />
else if (locale == "en"){<br />
xAxis.setFormatSpecifier( JavaDateFormatSpecifierImpl.create("hh:mm a"));<br />
}<br />
else{<br />
xAxis.setFormatSpecifier( JavaDateFormatSpecifierImpl.create("hh:mm"));<br />
}<br />
}<br />
<br />
Problem resolved