I need to use the cross hair on multi-series chart, and the chart number is a variable . the code is follow:
<? for ($i=0;$i<count($selItem);$i++) { ?>
<script type=”text/javascript”> $(function () { var chart = new CanvasJS.Chart(“chartContainer<? echo $i ?>”, {
//width: 100%, zoomEnabled: true, animationEnabled: true, //exportEnabled: true,
title: { text: “<? echo $selMsgName[$i] ?>” }, toolTip:{ shared: true }, axisX:{ crosshair : { enabled: true, color: “orange”, labelFontColor: “#F8F8F8”} },
axisY:{ margin: 30, interval: 1, labelFormatter: function (e) { return customLabel<? echo $i ?>(e.value); }, crosshair : { enabled: true, color: “orange”, labelFontColor: “#F8F8F8”},
},
data: [ { type: “stepLine”, connectNullData: true, markerSize: 5, dataPoints: [<? echo $data[$i] ?>] } ] }); chart.render(); }); </script>
<? } ?>
how can i do?
Hi; Indranil,
about 1. is ok, but when the mouse on second chart,the first chart is not work. about 2. my mean is to calculate the difference by selecting the two dataPoints.
Luis
Hi Suyash,
Thank you for your help. I’ve last two question. 1.Can i active crosshair axisX on each chart at same time? 2.Can i get the value of different between axis X two point ?
Luis Pang
The simulation results as picture.