JavaScript
var chart = new CanvasJS.Chart("chartContainer",
{
legend: {
cursor:"pointer",
itemclick : function(e) {
if (typeof(e.dataSeries.visible) === "undefined" || e.dataSeries.visible) {
e.dataSeries.visible = false;
} else {
e.dataSeries.visible = true;
}
chart.render();
}
},
title:{
text: "Two out of Three Series Appears on Legend"
},
data: [
{
showInLegend: true,
dataPoints: [
{ x: 10, y: 71},
{ x: 20, y: 55},
{ x: 30, y: 50 },
{ x: 40, y: 65 },
{ x: 50, y: 95 },
{ x: 60, y: 68 },
{ x: 70, y: 28 },
{ x: 80, y: 34 },
{ x: 90, y: 14}
]
},
{
showInLegend: f,
dataPoints: [
{ x: 10, y: 34},
{ x: 20, y: 45},
{ x: 30, y: 19 },
{ x: 40, y: 75 },
{ x: 50, y: 15 },
{ x: 60, y: 60 },
{ x: 70, y: 48 },
{ x: 80, y: 04 },
{ x: 90, y: 35}
]
},
{
showInLegend: true,
dataPoints: [
{ x: 10, y: 23},
{ x: 20, y: 16},
{ x: 30, y: 14 },
{ x: 40, y: 45 },
{ x: 50, y: 7 },
{ x: 60, y: 15 },
{ x: 70, y: 24 },
{ x: 80, y: 32 },
{ x: 90, y: 40}
]
},
]
});
chart.render();