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)
Set chart meter region at runtime
egau
Hello,
I'm tryin to set the start value and end value of regions in a meter chart in the beforedrawserie function but I got the error "TypeError: Cannot find function getDial in object class org.eclipse.birt.chart.model.component.impl.SeriesImpl"
for this code : function beforeDrawSeries( series, isr, icsc )
{
importPackage(Packages.org.eclipse.birt.chart.model.component.impl.*);
importPackage(Packages.org.eclipse.birt.chart.model.data.impl);
importPackage(Packages.org.eclipse.birt.chart.model.attribute);
importPackage(Packages.org.eclipse.birt.chart.model.attribute.impl);
series.getClass().getDial().getDialRegions().add(region);
. .
}
I tried series.getDial() , series.getClass().getComponent().getDial(). It doesn't work.
If you have an idea , I ll appreciate.
Egau.
Find more posts tagged with
Comments
egau
hi again,
No one can help on this ? it's tricky !
Regards.
egau
Am I really the only one who tries to do that ?????
Virgil Dodson
Hi egau, here is an example to add a region to a BIRT meter chart at runtime using scripting.<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
function beforeGeneration( chart, icsc )
{
importPackage(Packages.org.eclipse.birt.chart.model.component.impl);
importPackage(Packages.org.eclipse.birt.chart.model.attribute.impl);
importPackage(Packages.org.eclipse.birt.chart.model.attribute);
importPackage(Packages.org.eclipse.birt.chart.model.data.impl);
var firstAxis = chart.getSeriesDefinitions().get(0).getSeriesDefinitions().get(0).getRunTimeSeries().get(0).getDial();
var firstRange = DialRegionImpl.create();
firstRange.setFill(ColorDefinitionImpl.RED());
firstRange.setStartValue( NumberDataElementImpl.create( 0 ) );
firstRange.setEndValue( NumberDataElementImpl.create( 2 ) );
firstAxis.getDialRegions().add(firstRange);
var secondRange = DialRegionImpl.create();
secondRange.setFill(ColorDefinitionImpl.YELLOW());
secondRange.setStartValue( NumberDataElementImpl.create( 2 ) );
secondRange.setEndValue( NumberDataElementImpl.create( 5 ) );
firstAxis.getDialRegions().add(secondRange);
var thirdRange = DialRegionImpl.create();
thirdRange.setFill(ColorDefinitionImpl.GREEN());
thirdRange.setStartValue( NumberDataElementImpl.create( 5 ) );
thirdRange.setEndValue( NumberDataElementImpl.create( 6 ) );
firstAxis.getDialRegions().add(thirdRange);
}
</pre>
<br />
An example created with BIRT 2.3.2 is enclosed
egau
Thanks Vdodson, it works perfectely. It's Crazy how I tried lot of stuffs but it never worked.
And know I can delete my charthandler java class
.
nayak_anupam07
Can we get values from dataset and use it in script? for example range values from data set.?