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

Message ListMessage List     Post MessagePost Message

  Trackline with Legend data labels
Posted by Emilio on Feb-10-2017 17:25
Hi,

We are using the trackline with legend functionality with multiple axis.

Some of the series / axis are qualitative in nature and the axis are populated with setLabel()

Is it possible for the legend to display the axis label (has meaning) instead of the data value (only used for sorting)


Many Thanks

Emilio

  Re: Trackline with Legend data labels
Posted by Peter Kwan on Feb-11-2017 00:41
Hi Emilio,

Yes, you can use JsAxis.getFormattedLabel to obtain the label on an axis given a value on the axis. By default, if your axis is configured using Axis.setLabels, the value for those labels will be the array index 0, 1, 2, 3, ..... The "Track Box with Floating Legend (Web)" example demonstrates how to use this API for the x-axis. You can use it for the y-axis as well.

In brief, if your axis is configured with Axis.setLabels, then c.yAxis().getFormattedLabel(N) will be the (N+1)th label on the axis. If your data points are using that axis, the point data value should be integers to align with the labels. So the label for a point must be
c.yAxis().getFormattedLabel(pointValue).

Hope this can help.

Regards
Peter Kwan

  Re: Trackline with Legend data labels
Posted by Emilio on Mar-02-2017 21:23
Thanks that's awesome.

In my scenario I have multiple y-axis and yaxis2. How can refer to the correct axis to get the formatted label?

  Re: Trackline with Legend data labels
Posted by Peter Kwan on Mar-03-2017 03:52
Hi Emilio,

Instead of using c.yAxis().getFormattedLabel(N), may be try myDataSet.getUseYAxis().getFormattedLabel(N), where myDataSet is the data set that your data value comes from.

http://www.advsofteng.com/doc/cdnet.htm#JsDataSet.getUseYAxis.htm

Hope this can help.

Regards
Peter Kwan

  Re: Trackline with Legend data labels
Posted by Emilio on Mar-07-2017 22:10

Thanks, worked perfectly!