ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Number formatting within CDML
Posted by Mo on Oct-13-2016 18:35
Hi,

I am adding text strings to my charts using DrawArea.text and can format the text using CDML. Is there a way to format number strings added in this way using a syntax such as that used within 'Parameter Substitution and Formatting'?

Thanks

  Re: Number formatting within CDML
Posted by Peter Kwan on Oct-14-2016 00:27
Hi Mo,

As the DrawArea is basically a graphics API, there is no number formatting functions. You would need to use the features of your programming language to format the number into text strings before passing the text strings to DrawArea.

If you are using a chart object (like XYChart or PieChart), then there are number formatting functions. For example, BaseChart.formatValue.

If you prefer to use ChartDirector number formatting functions, and your DrawArea is obtained from a chart object (eg. using BaseChart.getDrawArea), then you already have the chart object that you can use to format the number. If the DrawArea is created directly without the chart object, you may consider to create a chart object anyway (just created a PieChart object 1 x 1 pixel in size) for the purpose of using its formatting function.

Hope this can help.

Regards
Peter Kwan

  Re: Number formatting within CDML
Posted by Mo on Oct-14-2016 00:53
Thank you very much, Peter.  BaseChart.formatValue is perfect.