How to call function() when click to color area in Kendo Pie Charts
1 Answer 10 Views
Stark
Top achievements
Rank 1
Iron
Iron
Stark asked on 15 May 2021, 03:00 AM | edited on 15 May 2021, 03:01 AM

Hi Admin and everybody,

I want call function() when click into color area. 

It will get category and value corresponding to that region. 

Can Kendo Pie Charts do that? 

Hope to get a reply soon from Admn and everybody. Thanks so much.

Code Demo architecture that I want to apply:

<script>
        var data = [
            {
                "source": "Hydro",
                "percentage": 22,
                "explode": true
            },
            {
                "source": "Solar",
                "percentage": 2
            },
            {
                "source": "Nuclear",
                "percentage": 49
            },
            {
                "source": "Wind",
                "percentage": 27
            }
        ];

        function createChart() {
            $("#chart").kendoChart({
                title: {
                    text: "Break-up of Spain Electricity Production for 2008"
                },
                legend: {
                    position: "bottom"
                },
                dataSource: {
                    data: data
                },
                series: [{
                    type: "pie",
                    field: "percentage",
                    categoryField: "source",
                    explodeField: "explode"
                }],
                seriesColors: ["#03a9f4", "#ff9800", "#fad84a", "#4caf50"],
                tooltip: {
                    visible: true,
                    template: "${ category } - ${ value }%"
                }
            });
        }

        $(document).ready(createChart);
        $(document).bind("kendo:skinChange", createChart);
    </script>
</div>


1 Answer, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 19 May 2021, 11:03 AM

Hello Stark,

You can use the seriesClick event that fires when the user clicks the chart series. All availabe data you can get is listed i nthe follwoing API article:

Here is the extended code in a Dojo demo:

Let me know if you have any questions.

Regards,
Nikolay
Progress Telerik

Тhe web is about to get a bit better! 

The Progress Hack-For-Good Challenge has started. Learn how to enter and make the web a worthier place: https://progress-worthyweb.devpost.com.

Asked by
Stark
Top achievements
Rank 1
Iron
Iron
Answers by
Nikolay
Telerik team
Share this question
or