function chartMouseClick(args) {
if (((args.target).indexOf('chart_legend_text') > -1))….. {
var chart1 = document.getElementById("container").ej2_instances[0];
chart1.series[0].fill = "red";
chart1.series[1].fill = "blue";
chart1.refresh();
}
} |
Before Click |
After Click |
|
|
<ejs-chart id="container1" chartMouseClick="chartMouseClick">
</ejs-chart>
function chartMouseClick(args) {
console.log(args.target);
}
|
<ejs-chart chartMouseClick="chartMouseClick">
</ejs-chart>
function chartMouseClick(args) {
if (((args.target).indexOf('chart_legend_shape') > -1) ||
(args.target).indexOf('chart_legend_shape_marker_') > -1) {
//Shown the color here
alert(document.getElementById(args.target).getAttribute("fill"));
} else if ((args.target).indexOf('chart_legend_text')> -1) {
//Shown the text here
alert(document.getElementById(args.target).innerHTML);
}
}
|