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:
now need change format number of datapoint labels depending on type of selected indicator. in birt designer defined percent format default:
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
Post a Comment