Rendering a BIRT chart as Flex or Flash (BIRT 2.6.1) [message #899247] |
Tue, 31 July 2012 08:29 |
Anthony Farrell Messages: 25 Registered: April 2011 Location: Ireland |
Junior Member |
|
|
I will attempt to explain this as simply as possible.
We have a requirement to render BIRT charts as Flex, we have done so by using the recommended Device Renderer extension mechanism. I know that Actuate has support for Flex charts, however our requirement is to provide this feature to clients without mandating that clients have to license Actuate, when clients see and like Flex charts, clients can further leverage Flex by purchasing an Actuate component that fits their budget and needs.
When we render the chart as a standard BIRT PNG image the category and value axis titles are localised correctly, the chart title is also localised as expected.
The issues we are having are two-fold:
Issue #1 is that the chart title is being displayed in Flex as "un localised text".
Issue #2 is that the value axis title (vertical axis title) is being displayed in as "un localised text", the category axis is being returned as a correctly localised string. E.g. in a bar chart the vertical axis (value axis) title is in English , and it is not displaying the correct axis title from the associated "property" file to the language being used.
Lets review issue #1 first, my questions on the chart title issue are:
1) Should the API call below "_iun.getDesignTimeModel().getTitle()" return the localised title?, is there a bug in this API call if the title is returned not localised, is this bug fixed in a newer BIRT release(we are using BIRT 2.6.1).
2) If the API call below "_iun.getDesignTimeModel().getTitle()" is not designed to return a localised chart title, can you tell me what API to use ?
Our device render is implemented by leveraging the following API's
Issue #1 - getting a localised chart title
OurDeviceRendered extends
org.eclipse.birt.chart.device.DeviceAdapter implements IIOWriteWarningListener, IImageMapEmitter {
//We get the Chart title using the following update notifier.
private IUpdateNotifier _iun = null;
public void setProperty(String sProperty, Object oValue) {
super.setProperty(sProperty, oValue);
pngRender.setProperty(sProperty, oValue);
if (sProperty.equals(IDeviceRenderer.UPDATE_NOTIFIER)) {
_iun = (IUpdateNotifier) oValue;
...
}
public void after() throws ChartException {
super.after();
if (_iun.getDesignTimeModel().getTitle().isVisible()) {
String title = _iun.getDesignTimeModel().getTitle()
.getLabel().getCaption().getValue();
// set the chart title as the alt text for the flex image
// the chart title returned is the default title not the localised title
// from the properties file associated with the report
// should we use the run time model ?, or some other API calls
}
...
}
|
|
|
Re: Rendering a BIRT chart as Flex or Flash (BIRT 2.6.1) [message #899392 is a reply to message #899247] |
Tue, 31 July 2012 16:25 |
|
Anthony
If you are using localizing the title in the chart editor by the time it
gets to the renderer it should already have the proper value. If you
look at the renderLabel function in the Chart BaseRenderer.java class
you will see this code:
final LabelBlock lb = (LabelBlock) b;
Label la = lb.getLabel( );
final String sPreviousValue = la.getCaption( ).getValue( );
la.getCaption( ).setValue( rtc.externalizedMessage( sPreviousValue ) );
You can see the rtc is used to get the localized message. This is
before it calls any device renderer's drawText function.
In your example are you add the resource to the report and are you
setting its key in the designer?
Jason
On 7/31/2012 4:29 AM, Anthony Farrell wrote:
> I will attempt to explain this as simply as possible.
> We have a requirement to render BIRT charts as Flex, we have done so by
> using the recommended Device Renderer extension mechanism. I know that
> Actuate has support for Flex charts, however our requirement is to
> provide this feature to clients without mandating that clients have to
> license Actuate, when clients see and like Flex charts, clients can
> further leverage Flex by purchasing an Actuate component that fits their
> budget and needs.
>
> When we render the chart as a standard BIRT PNG image the category and
> value axis titles are localised correctly, the chart title is also
> localised as expected.
> The issues we are having are two-fold:
>
> Issue #1 is that the chart title is being displayed in Flex as "un
> localised text".
> Issue #2 is that the value axis title (vertical axis title) is being
> displayed in as "un localised text", the category axis is being returned
> as a correctly localised string. E.g. in a bar chart the vertical axis
> (value axis) title is in English , and it is not displaying the correct
> axis title from the associated "property" file to the language being used.
>
> Lets review issue #1 first, my questions on the chart title issue are:
>
> 1) Should the API call below "_iun.getDesignTimeModel().getTitle()"
> return the localised title?, is there a bug in this API call if the
> title is returned not localised, is this bug fixed in a newer BIRT
> release(we are using BIRT 2.6.1).
> 2) If the API call below "_iun.getDesignTimeModel().getTitle()" is not
> designed to return a localised chart title, can you tell me what API to
> use ?
>
>
> Our device render is implemented by leveraging the following API's
>
>
> Issue #1 - getting a localised chart title
>
>
>
> OurDeviceRendered extends
> org.eclipse.birt.chart.device.DeviceAdapter implements
> IIOWriteWarningListener, IImageMapEmitter {
>
> //We get the Chart title using the following update notifier.
> private IUpdateNotifier _iun = null;
>
> public void setProperty(String sProperty, Object oValue) {
> super.setProperty(sProperty, oValue);
> pngRender.setProperty(sProperty, oValue);
> if (sProperty.equals(IDeviceRenderer.UPDATE_NOTIFIER)) {
> _iun = (IUpdateNotifier) oValue;
> ...
> }
>
> public void after() throws ChartException {
> super.after();
>
>
> if (_iun.getDesignTimeModel().getTitle().isVisible()) {
> String title = _iun.getDesignTimeModel().getTitle()
> .getLabel().getCaption().getValue();
>
> // set the chart title as the alt text for the flex image
> // the chart title returned is the default title not the
> localised title // from the properties file associated with the
> report
>
> // should we use the run time model ?, or some other API calls
>
> }
> ...
> }
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.04247 seconds