javascript - Event does not fire up in Kendo -
the mouse hover
event not fire up. not able figure out
function createchart() { $("#chart") .kendochart({ xaxis: {}, yaxis: {}, seriesdefaults: {type: "scatterline" }, series: [{data: stats2}], }) } // following part not fire var ishover = false; $("#chart").hover( function () { if (!ishover) { var chart = $("#chart").data().kendochart; chart.options.series.data=stats2; ishover = true; } }, function () { if (ishover) { var chart = $("#chart").data().kendochart; chart.options.series.data=stats; ishover = false; } });
you need learn debug bro, wasn't hover function not triggered write code carelessly.
the series
property in chart's options array
. therefore need index access it. because intend change series instead of data, have call redraw
method right after change series data.
this code work
var ishover = false; $("#chart").hover( function () { if (!ishover) { var chart = $("#chart").data().kendochart; chart.options.series[0].data = stats2; chart.redraw(); ishover = true; } }, function () { if (ishover) { var chart = $("#chart").data().kendochart; chart.options.series[0].data = stats; chart.redraw(); ishover = false; } });
have day, cheers!!
Comments
Post a Comment