When user hovers the mouse on the #chart
, then second data is drawn.
当用户将鼠标悬停在#chart上时,则绘制第二个数据。
However I would like to know when user hovers the mouse on the first data line by itself not #chart then second data line is drawn.
但是我想知道当用户将鼠标悬停在第一条数据线上而不是#chart时,则绘制第二条数据线。
function createChart() {
$("#chart")
.kendoChart({
xAxis: {},
yAxis: {},
seriesDefaults: {type: "scatterLine" },
series: [{data: stats2},{name:"gmail"}],
})
}
var isHover = false;
$("#chart").hover(
function () {
if (!isHover) {
var chart = $("#chart").data().kendoChart;
chart.options.series[0].data = stats2;
chart.options.series[0].name="yahoo";
chart.redraw();
isHover = true;
}
}, function () {
if (isHover) {
var chart = $("#chart").data().kendoChart;
chart.options.series[0].data = stats;
chart.options.series[0].name="";
chart.redraw();
isHover = false;
}
});
http://jsfiddle.net/epvg86qu/12/
1 个解决方案
#1
Add this within createChart (and replace the function with your desired behavior). This example just writes "hello" to the console.
在createChart中添加它(并用您想要的行为替换该函数)。这个例子只是向控制台写“hello”。
function createChart() {
$("#chart")
.kendoChart({
xAxis: {},
yAxis: {},
seriesDefaults: {type: "scatterLine" },
series: [{data: stats2},{name:"gmail"}],
seriesHover: function(e) {
console.log("hello");
}
})
}
#1
Add this within createChart (and replace the function with your desired behavior). This example just writes "hello" to the console.
在createChart中添加它(并用您想要的行为替换该函数)。这个例子只是向控制台写“hello”。
function createChart() {
$("#chart")
.kendoChart({
xAxis: {},
yAxis: {},
seriesDefaults: {type: "scatterLine" },
series: [{data: stats2},{name:"gmail"}],
seriesHover: function(e) {
console.log("hello");
}
})
}