Home Analytics Designing reports
The community of Analytics developers are invited to follow and participate in the developer network.
OpenText technical experts collaborate with supported customers and partners in the Magellan product area.

Set chart meter region at runtime

egauegau Junior Member
edited December 31, 1969 in Designing reports
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.

Comments

  • egauegau Junior Member
    edited December 31, 1969
    hi again,

    No one can help on this ? it's tricky !

    Regards.
  • egauegau Junior Member
    edited December 31, 1969
    Am I really the only one who tries to do that ?????
  • VirgilVirgil Administrator EM admin
    edited December 31, 1969
    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

    Virgil Dodson
    OpenText Analytics Developer Community
    https://forums.opentext.com/forums/categories/analytics

  • egauegau Junior Member
    edited December 31, 1969
    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 :).
  • Can we get values from dataset and use it in script? for example range values from data set.?
Sign In or Register to comment.