0

I am facing an issue while fetching the data from "this" which actually prints a JSON object on the console. If I am going to use "this.x" then I am getting a run time error.

          formatter: function() {            
                    console.clear();
                    console.log("Point Details: ",this);
          }

the output of this console statement is:

{x: Array(1), y: 69, color: '#FFBF00', colorIndex: 0, key: 'ABCTest'}

Now if I do console like this-console.log(this.x) I am getting this error: enter image description here

Note: this code snippet is the part of Angular's Highchart tooltip formatted function.

Can anyone help me how I can access these values using "this" plus "." operator.

2
  • Do you use an array function in your example? It changes the scope, so it may cause this kind of issue. If not, could you please reproduce this issue in the online editor that I could work on? Commented Aug 11, 2022 at 10:26
  • 1
    @magdalena - Using the event along with the formatter function, I am able to modify the tooltips. Thanks for all your help. Commented Aug 17, 2022 at 21:00

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.