0

When user hovers the mouse on the #chart, then second data is drawn.

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.

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/

casillas
  • 16,351
  • 19
  • 115
  • 215
  • Can you please clarify what your desired behavior is? – kaz May 11 '15 at 17:20
  • @kaz, in the jsfiddle demo, when you hover the mouse on the chart then it loads second line. Instead of hovering mouse on the chart, I want to have same functionality on the line itself. When user hovers or clicks on the line, then will load second line. I hope I am clearer. Let me know please – casillas May 11 '15 at 17:24

1 Answers1

2

Add this within createChart (and replace the function with your desired behavior). This example just writes "hello" to the console.

function createChart() {
    $("#chart")
        .kendoChart({
            xAxis: {},
            yAxis: {},
            seriesDefaults: {type: "scatterLine" },
            series: [{data: stats2},{name:"gmail"}],
            seriesHover: function(e) {
                console.log("hello");
            }
        })
}
kaz
  • 1,190
  • 8
  • 19