Highlight clicked bar series

大城市里の小女人 提交于 2019-12-12 00:33:23

问题


Is there any built in method in kendo when user clicks on the bar chart item, then it will highlight all corresponding items?

For example in the following fiddle, there are five items. If I click item1 in the first bar (1970), it should highlight item1 in second bar (1975).

series: [{
   type: "column",
   field: "value",
   stack: true,
   name: "#= group.value #"
}],

回答1:


You can add the seriesClick event. Then determine which series was clicked and use the toggleHighlight() method to turn off highlighting on all other series and turn it on for the clicked one:

seriesClick: function(e) {
    var clickedSeries = e.series.name;
    var chart = $("#chart").data("kendoChart");
    for (var i=0; i< chart.options.series.length; i++){
        chart.toggleHighlight(false, chart.options.series[i].name);
    }
    chart.toggleHighlight(true, clickedSeries);
}

Updated FIDDLE



来源:https://stackoverflow.com/questions/30519880/highlight-clicked-bar-series

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!