How to format series labels of a BIRT chart by script -


i have chart report displaying indicator values on time. indicator report parameter , can represent either percent (%) or currency ($) value.

here example percent type:

enter image description here

now need change format number of datapoint labels depending on type of selected indicator. in birt designer defined percent format default:

enter image description here

the indicator type extracted dataset , stored in persistent global var, can accessed in chart scripts.

in data field of crosstab format changed in "oncreate" event like:

 this.getstyle().numberformat="$ #,###"; 

but in chart scripts can't find out way change format number dynamically. suggestion appreciated!

this question has been answered in opentext forums here. can format datapoint labels in chart event "beforedrawdatapointlabel". in example below, expected number format (for instance "$ #,###") stored in global variable "numberformat":

importpackage(packages.java.text); nf = new decimalformat(getglobalvariable("numberformat"));  function beforedrawdatapointlabel( dph, label, icsc ){    label.getcaption().setvalue(nf.format(dph.getorthogonalvalue())); } 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -