2

I have a Json Array like below:

[{"label":"08\/09\/2015 03:15:49 AM","y":0.6,"y1":0.3,"y2":"0.3(XYZ)","y3":"0.6(XYZ)"},
 {"label":"03\/09\/2015 04:23:04 AM","y":0.2,"y1":0.4,"y2":0.4,"y3":0.2},
 {"label":"02\/09\/2015 12:50:56 AM","y":0.4,"y1":0.4,"y2(XYZ)":0.4,"y3":0.4}]

And My javascript code in HighChart as below:

    for (var i = 0; i < length; i++) {
        dataXAxis.push(obj[i].label);
        dataPointsLeft.push(obj[i].y);
        dataPointsRight.push(obj[i].y1);
        dataPointsLeft1.push(obj[i].y2);
        dataPointsRight1.push(obj[i].y3);
    }

     $('#xyz').highcharts({
            title: {
                text: "Demo",
                x: -20 //center
            },
            xAxis: {
                categories: dataXAxis
            },
            tooltip: {
                useHTML: true,
                shared: true
            },
            series: [{
                    name: "X",
                    data: dataPointsRight,
                    color: '#FF0000'
                }, {
                    name: "Y",
                    data: dataPointsLeft,
                    color: '#0000FF'
                }]
        });

Now my question is that i want to display "dataPointsLeft1" array as in ToolTip. Right now my ToolTip display same as dataPointsLeft data but i want the data on tooltip from "dataPointsLeft1" array. Please advice As soon As possible.

Thank you.

1 Answer 1

3

Use like this while pushing:

    dataPointsLeft.push({y: obj[i].y, custom: obj[i].y1}); 
    dataPointsRight.push({y: obj[i].y1, custom: obj[i].y3}); 

and in tooltip you can use

 tooltip: {              
     formatter: function () { 
          var series = this.series;
         return this.point.custom;
      }
  } 

See the fiddle at https://jsfiddle.net/Nishith/gjezx1kq/

Sign up to request clarification or add additional context in comments.

6 Comments

What i need to do if i do the mouse hover on same point then it's display both values at same time? For Example, If i do the mouse hover on point of "X" then it's display for both "X" and "Y" values at same time. And also if i do the mouse hover on point of "Y" then it's also displays both "X" and "Y" values of same points at same time. Please Advice ASAP.
@ChetanNakum both values ? means Y and Y1 ?
No, It's Y1 and Y3. For Ex., If i do the mouse over on point of "X" then it's display like : X : 0.6 (XYZ) Y : 0.3 And also if i do the mouse over on point of "Y" then it's also display like : X : 0.6 (XYZ) Y : 0.3
use return this.y +" and"+this.point.custom; see updated fiddle at jsfiddle.net/Nishith/gjezx1kq/1
Thank you for reply but i want the result like : X : 0.6 (XYZ) Y : 0.3 On any point of Mouse Hover ("X" or "Y"). Please Advice ASAP.
|

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.