Ticket T440900
Visible to All Users

dxChart - How to access points in customizeLabel

created 8 years ago

Dear Sir or Madam,

in the attached demo file you see that a chart is displayed. I took the code from one of your widget demos. What I want to do is conditionally displaying a label for specific points. To achieve this I need to compare the value of the current point to the values of other points of the same series and to points of other series. When I call "pointInfo.series.getAllPoints()" (site.js, line 94), I get an empty array. The same is true for getAllPoints called on other series.

Thus my question is:
How do I compare the value of the current point to the values of other points in the same and other series within the customizeLabel-event?

I also reproduced this behavior with DevExtreme 2016.1.7.

Please note that I removed the packages-folder to reduce the size of the attachment.

Kind Regards

CosmosDev

Answers approved by DevExpress Support

created 8 years ago (modified 8 years ago)

Hi,

When the customizeLabel function is executed, all points are not prepared yet. Use the customizeText event to check points and hide certain labels. For example:

JavaScript
customizeLabel: function (pointInfo) { return { customizeText: function(args){ var allPoints = pointInfo.series.getVisiblePoints(); ..... if (condition) { // hide label return ""; } }, visible: true } }

Let me know if this information helps.

    Comments (3)

      Thank you Artem, this solves a part of my problem.
      I also have to change the label color based on the comparison to the other points. Is this possible?

      Kind Regards

      CosmosDev

        Hello Artem,

        I solved the problem in doing the comparison of the values within the original data source (I identified the corresponding value-object via the "argument").
        It would still be great if this was possible working directly with the points.

        Kind Regards.

        CosmosDev

        Artem (DevExpress Support) 8 years ago

          Thanks for the update. Currently, customizeLabel and customizePoint handlers are executed before points are created. So, your solution is correct.

          Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

          Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.