Actual value and percentage

I had done a Report with chart so in that they was a parameter like Type...with value like  Actual value and percentage...so to show a percentage i have wrote a script like 

 

 

importPackage(Packages.org.eclipse.birt.chart.model.attribute);importPackage( Packages.org.eclipse.birt.chart.model.attribute.impl );function beforeDrawSeries( series, isr, icsc ){if(series.getSeriesIdentifier() == "Series 1"){labelType = icsc.getExternalContext().getScriptable().getParameterValue("Types");if(labelType == "Percentage"){series.getDataPoint().getComponents().get(0).setType(DataPointComponentType.PERCENTILE_ORTHOGONAL_VALUE_LITERAL);}}}
 
 it had show value  like in screenshot....but my requirement like the value is 75000,1015,1212,1352, it have to show in bar chart like  75%,25%,10%,7% ..how to change like this...

Comments

  • edited October 18, 2013

    if any body have some idea to this....?

  • There is no enough information here for me to fully understand the data and the issue.  But if you can build a table that has the all the numbers, then you should be able to build your graph using the table as a data source.  Once the Graph is working you can hide the table.

    Silence Bestows Consent
  • kclarkkclark BIRT Guru EM
    edited November 4, 2013

    In the onFetch() of my data set I calculated the total and stored it as a PGV to call later from the chart script.

    var currentValue = row["AMOUNT"];var total = parseInt(reportContext.getPersistentGlobalVariable("total"))total += currentValue;reportContext.setPersistentGlobalVariable("total", total.toString())

    Then in my chart I made sure to display the value data so I could use it when calculating the percentages.  Then I displayed them with the following

    var currentValue = 0.0;var total        = 0.0;function beforeDrawSeries( series, isr, icsc ){  total        = icsc.getExternalContext().getScriptable().getPersistentGlobalVariable("total");}function beforeDrawDataPointLabel( dph, label, icsc ){  var stringValue = dph.getDisplayValue();  var currentValue = parseFloat(stringValue.replace(",",""));  var percentage = (currentValue/total) * 100;      label.getCaption().setValue((percentage).toFixed(2) + "%")}

    Kristopher Clark

    Actuate Corporation – The BIRT Company™

    http://www.actuate.com | http://birtondemand.com

     

    My Blog

    Twitter

    LinkedIn
    Facebook
     



  •  


    In the onFetch() of my data set I calculated the total and stored it as a PGV to call later from the chart script.



    var currentValue = row["AMOUNT"];var total = parseInt(reportContext.getPersistentGlobalVariable("total"))total += currentValue;reportContext.setPersistentGlobalVariable("total", total.toString())

    Then in my chart I made sure to display the value data so I could use it when calculating the percentages.  Then I displayed them with the following



    var currentValue = 0.0;var total = 0.0;function beforeDrawSeries( series, isr, icsc ){ total = icsc.getExternalContext().getScriptable().getPersistentGlobalVariable("total");}function beforeDrawDataPointLabel( dph, label, icsc ){ var stringValue = dph.getDisplayValue(); var currentValue = parseFloat(stringValue.replace(",","")); var percentage = (currentValue/total) * 100; label.getCaption().setValue((percentage).toFixed(2) + "%")}



    Hi


     


    I have a similar requirement, Instead of dataset I'm using Data model in my report using .data


     


    Can you please explain how can i achieve the same using data model because the script feature is not enabled for model


    As per your design we need to calculate total and assign it to PGV on OnFetch method of dataset.

  • In iHub 16, there is a new feature where you can add computed measures into the Data Model.


    Clement Wong
    Principal Analytics Architect

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



  • In iHub 16, there is a new feature where you can add computed measures into the Data Model.




    Thanks Wong ,


     Since i am new in Actuate Could you please explain in Detail

  • Clement WongClement Wong EM mod
    edited June 7, 2016

    In iHub 16, users can create their own measures when using the iHub, but the (Data Model) architect can predefine ones in the Data Model.


     


    A measure uses an aggregation function to create a predefined summary of an expression. For example, a measure named SalesValue is the expression Price * Quantity and the aggregation function SUM and a measure named AverageSale is the expression SalesValue / LineCount. AverageSale is known as a derived measure because it uses the values of other measures. There is no difference in the usage of standard and derived measures. The data architect provides meaningful names for the measures so that report developers can easily understand the value that the measure provides.


     


    Using data model measures is a convenient way to access aggregated data in charts and cross tabs. Just drag the measure from the data model and drag it into the Y-axis of a chart or the summary area of a cross tab. No setting of aggregation functions is required. The measure is also available to create summary values for groups and grand totals in a cross tab.


    Clement Wong
    Principal Analytics Architect

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

Sign In or Register to comment.