突出显示点击栏系列 [英] Highlight clicked bar series

查看:99
本文介绍了突出显示点击栏系列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当用户单击条形图项目时,kendo中是否有任何内置方法,然后它将突出显示所有对应的项目?

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

例如,在下面的小提琴中,有五个项目.如果单击first bar (1970)中的item1,它将突出显示second bar (1975)中的item1.

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 #"
}],

推荐答案

您可以添加seriesClick事件.然后确定单击了哪个系列,并使用toggleHighlight()方法关闭所有其他系列上的突出显示,并为被单击的系列打开它:

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);
}

这篇关于突出显示点击栏系列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆