Is there a way of getting the original axis label text

Posted by: Yifan_Zhang on 16 October 2020, 4:23 am EST

    • Post Options:
    • Link

    Posted 16 October 2020, 4:23 am EST

    We were doing some axis label formatting via the itemFormatter, but after the formatting, we would still like to retrieve the original label text. How can we do that? I noticed there is a private property “_lbls” for axis. But how can we get the index of “_lbls” for the current label (the axis min/max could be changed)? Also is there any intention to expose those properties as public? Thanks.

  • Posted 18 October 2020, 7:36 pm EST

    Hi Yifan,

    You can save the original labels and the formatted labels in a different object by using the itemFormatter property. Then you can get the original labels by using the formatted labels as per your requirements. In the rendering event of the FlexChart, you can empty this object because the itemFormatter of the Axis runs after the rendering event. So, if the min/max is updated, then the labels object will also be updated accordingly. Please refer to the sample below for reference:

    https://stackblitz.com/edit/js-zwwvfo

    Also is there any intention to expose those properties as public?

    I have asked the developers on whether they will make the property public. The internal tracking id of the case is 467386. I will update you once I will hear from them.

    Regards,

    Ashwin

  • Posted 19 October 2020, 7:05 pm EST

    Thanks for the solution. Though we have to keep an extra copy of all the labels, that works well.

  • Posted 14 January 2021, 7:33 pm EST

    Hi Yifan,

    The developers have added a new property in the Axis class known as axisLabels. This property will expose the original axis labels.

    You can verify this property using the sample link below:

    https://stackblitz.com/edit/js-j3sgrk

    This property will be made public in the next release.

    ~regards

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels