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)
User defined properties access in Chart Java Event Handler
Rashmi
Hi,<br />
<br />
I am writing a Chart Event Handler in Java. There are some user defined properties for the Chart , but these are not accessible in any of the methods in the ChartEventHandlerAdapter . <br />
<br />
After going through the APIs , figured out that the user properties are only available through the IDesignElement interface , however the methods in ChartEventHandlerAdapter (e.g. public void beforeGeneration(Chart cm, IChartScriptContext icsc)) provides org.eclipse.birt.chart.model.Chart which does not implements IDesignElement interface . <br />
<br />
One workaround is to get the ReportDesignHandle and then get the user property . Here is a code snippet :<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>final IReportContext reportContext = (IReportContext) icsc.getExternalContext().getObject();
ReportDesignHandle designhandle = reportContext.getDesignHandle();
IReportDesign reportDesign = new ReportDesign( designhandle );
reportDesign.getReportElement("barChart").getUserPropertyExpression("tty");</pre>
<br />
The problem with code above is that if I am trying to make this handler a reusable class , then it is not possible as to get the chart report element without hardcoding the element name or id . <br />
<br />
There seems to be no way by which the name/id of current chart can retrieved through the inputs parameters of the methods in ChartEventHandlerAdapter. May be I am missing something , as I am new to BIRT , please help. <br />
<br />
Thanks,<br />
Rashmi
Find more posts tagged with
Comments
mwilliams
Can you explain more of exactly what you're trying to do? Are you trying to grab these properties from all charts in your report?
Rashmi
Thanks for the reply!
I am trying to extend the behaviour of a chart and make the extended behavior reusable .
One of the usecase is :
I want to define a user property colorScheme , based on the value of this property I will change the series fill fill of the chart programatically . I know this can be done by changing the style of the chart but I need to do this in a controlled way so that only the colors will be changed not the font and other style elements.
The user defined properties need to be extracted from the charts for which this Java event handler is specified.
Hope this makes the problem more clear. Please let me know if any other information is required.