Home forums Using CanvasJS Dynamic name Option Reply To: Dynamic name Option

#21199

Chetnath
Member

Thanks for the reply

please check the tooltip in given url, in both images tooltip are showing “Growth” text while it should be show “Profit” when line goes positive and “Loss” when it goes down (Negative).

https://prnt.sc/jxpgmu
https://prnt.sc/jxphag

my code

$(function () {

var chart = new CanvasJS.Chart(“PLBYMContainer”, {
animationEnabled: true,
exportEnabled: true,
theme: “light2”, // “light1”, “light2”, “dark1”, “dark2”
title:{
text: “Profit & Loss (By month)”,
fontSize: 25
},
axisX:{
reversed: false,
title: “Profit & loss”
},
axisY:{
title: “Range (in %)”,
suffix: “%”,
includeZero: false
},
toolTip:{
shared: true
},
data: [{
type: “line”,
showInLegend: false,
indexLabelFormatter: function ( e ) {
return “₹ “+e.dataPoint.value;
},
name: “Growth”,
yValueFormatString: “#,##0.0#\”%\””,
dataPoints: <?php echo json_encode($PLByMonth, JSON_NUMERIC_CHECK); ?>
}]
});