简体   繁体   English

Kendo UI Chart - 单击事件

[英]Kendo UI Chart - Click Events

Does anyone know how to create an on-click event for the Kendo-UI data viz bar graphs? 有谁知道如何为Kendo-UI数据viz条形图创建一个点击事件?

I have this graph inside a kendo window, and when you click on one of the bars, I need to swap out the content of the window. 我在kendo窗口中有这个图表,当你点击其中一个栏时,我需要换掉窗口的内容。

I can't seem to find the right element to attach the click to..... 我似乎找不到合适的元素来附加点击.....

The kendo code...... 剑道代码......

 <script> // Kendo Chart
            function createChart() {
                $("#chart").kendoChart({
                    title: {
                        text: "Memberships by dddd- dddd"
                    },
                    legend: {
                        visible: true
                    },
                    seriesDefaults: {
                        type: "bar"
                    },
                    series: [{
                        name: "dddd",
                        data: [123, 42, 76, 344],
                        color: '#0A9ECC'
                    }, {
                        name: "dddd",
                        data: [76, 970, 23, 14],
                        color: '#CE1D1D'
                    },
                    {
                        name: "ddddd",
                        data: [144, 44, 264, 647],
                        color: '#d2b723'
                    }],
                    valueAxis: {
                        max: 1000,
                        line: {
                            visible: false
                        },
                        minorGridLines: {
                            visible: true
                        }
                    },
                    categoryAxis: {
                        categories: ["Membership 1", "Membership 2", "Membership 3", "Membership 4"],
                        majorGridLines: {
                            visible: false
                        }
                    },
                    tooltip: {
                        visible: true,
                        template: "#= series.name #: #= value #"
                    }
                });
            }
            $(document).ready(createChart);
            $(document).bind("kendo:skinChange", createChart);
        </script>

I think you are looking for the seriesClick event. 我想你正在寻找seriesClick事件。

$(".k-chart")
  .data("kendoChart")
  .bind("seriesClick", function (e) { console.log(e); })

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM