You must be logged in to post your query.
Home › Forums › Chart Support › Time in Axis Y and sync cross hair in multiple series
Hello, I create a chart with 3 series, and on the axis Y there is time. To create this chart I follow this example. But if I want to use the folliwing option I can see the value only of one serie and not of all the three series when I put the mouse on the chart:
toolTip:{ shared: true, }
The following function elaborate only one and not all the three series:
contentFormatter: function (e) { return CanvasJS.formatDate(e.entries[0].dataPoint.y,"hh:mm:ss TT"); //Formatting dateTime in ToolTip }
Can someone help me?
Thank you very much
@begins,
In order to display y values of all the dataSeries in a toolTip, you can loop through each of the e.entries and display the respective y values in appropriate format. Please check out the below code snippet.
contentFormatter: function (e) { var content = ""; content += e.entries[0].dataPoint.x + "<br/>" for(var i=0; i<e.entries.length; i++) { content += "<span style= \"color:"+e.entries[i].dataSeries.color + "\">" + e.entries[i].dataSeries.name + "</span>: " + CanvasJS.formatDate(e.entries[i].dataPoint.y,"hh:mm:ss TT") + " <br/>"; //Formatting dateTime in ToolTip } return content; }
Also, take a look at this JSFiddle for complete code.
—- Manoj Mohan Team CanvasJS
Thank you very much Manoj Mohan, it seems to work perfectly!
You must be logged in to reply to this topic. Login/Register