Dynamically change Meter chart scale and regions according column value

Hi Team,


 


I am creating meter chart using BIRT ,i want to change the meter regions  value according fetched column value and also change scale according fetch column value+30%of that same column value ,this is actually meter structure and needle will show the another column value in  the above mentioned meter.How to dynamically change regions and scale?


 


Can anyone please suggest me any idea on the same ?


 


thanks in Advance.


 


Regards


Amruta.


Comments

  • You'll need to fetch the column value first before applying it in the meter, and you can do this via the following methods:


    1. API
    2. A hidden table and setting a (PGV) variable so that the meter can access it
    3. In the Data Set's onFetch event and setting a (PGV) variable so that the meter can access it

     


    To change the scale, you can look at this DevShare example:


    http://developer.actuate.com/community/forum/index.php?/files/file/664-change-meter-scale-with-script/


     


     


    In the example below, we change the end value of the first region to 30,000:



    function beforeGeneration( chart, icsc )
    {

    importPackage( Packages.org.eclipse.birt.chart.model.data.impl );

    var seriesDef = chart.getSeriesDefinitions().get(0);
    var seriesIterator = seriesDef.getSeriesDefinitions().get(0).getRunTimeSeries().listIterator();
    while(seriesIterator.hasNext()){
    var meter = seriesIterator.next();
    var meterDial = meter.getDial();


    // Get a handle to the first region and set the end value to 30,000
    var dialRegions = meterDial.getDialRegions();
    var dialRegion1 = dialRegions.get(0);
    dialRegion1.setEndValue(NumberDataElementImpl.create(30000));


    var meterScale = meterDial.getScale();
    meterScale.setStep(3);
    meterScale.setMin(NumberDataElementImpl.create(0));
    meterScale.setMax(NumberDataElementImpl.create(80000));
    }
    }

    Clement Wong
    Principal Analytics Architect

    OpenText Corporation
    http://www.actuate.com | http://www.opentext.com

  • Thank you,


    Perfect ,its working properly.


     


    I have one question is that how to show only one column  value on tip of the needle ?




  • Thank you,


    Perfect ,its working properly.


     


    I have one question is that how to show only one column  value on tip of the needle ?




     


    I'm sorry I don't quite understand your latest requirement.  Column?  Can you please share a screenshot of what you are currently seeing, and another screenshot of what you would like to see?

    Clement Wong
    Principal Analytics Architect

    OpenText Corporation
    http://www.actuate.com | http://www.opentext.com

  • Thank you for reply.


    I want to show only 97.00 value on tip of the needle in current meter.0


    this value come from data set(row["sum''])


  • edited May 25

    Sorry, I'm not aware of this capability to show the value near/at the tip of the needle with open source BIRT charts.


     


    In commercial BIRT, with the HTML5 charts, it's possible.  Or if you want in open source BIRT, you can use a JavaScript chart like D3.js, HighCharts, etc...


    Clement Wong
    Principal Analytics Architect

    OpenText Corporation
    http://www.actuate.com | http://www.opentext.com

  • Thanks for your help and best regards  :) 


Sign In or Register to comment.