Search code examples
chartsdygraphs

How to get control of canvas lines shown in Dygraph?


I want to take the control of Canvas lines of Dygraph similar to that of highcharts. To get an idea please check the following jsfiddle.

Reference: jsfiddle

Highcharts.chart('container', {
xAxis: {
    categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
},

plotOptions: {
    series: {
        cursor: 'pointer',
        point: {
            events: {
                click: function () {
                    alert('Category: ' + this.category + ', value: ' + 
 this.y);
                }
            }
        }
    }
 },

series: [{
    data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 
194.1, 95.6, 54.4]
}]
});

Solution

  • There's a pointClickCallback option that you can set. See the callback demo for an example. Note that this will catch clicks on points but not the lines connecting them.