This is a migrated thread and some comments may be shown as answers.

onSeriesClick Event Handler not working

4 Answers 532 Views
Charts
This is a migrated thread and some comments may be shown as answers.
Sam
Top achievements
Rank 1
Sam asked on 07 Mar 2012, 11:20 AM
I've copied and pasted the onSeriesClick function and it doesn't seem to be working for some reason,

<script type="text/javascript">
            function createChart() {
                $("#chart").kendoChart({
                    theme: $(document).data("kendoSkin") || "default",
                    title: {
                        text: "Project Management"
                    },
                    legend: {
                        position: "bottom"
                    },
                    seriesDefaults: {
                        labels: {
                            template: "#= kendo.format('{0:P}', percentage)#",
                            visible: true
                        }
                    },
                    series: [{
                        type: "pie",
                        data: [{
                            category: "Quality",
                            value: 80
                        }, {
                            category: "Time",
                            value: 80
                        }, {
                            category: "Cost",
                            value: 80
                        }]
                    }],
                    tooltip: {
                        visible: true,
                        template: "#= kendo.format('{0:P}', percentage)#"
                    }
                });
            }


            $(document).ready(function () {
                setTimeout(function () {
                    // Initialize the chart with a delay to make sure
                    // the initial animation is visible
                    createChart();


                    $("#example").bind("kendo:skinChange", function (e) {
                        createChart();
                    });
                }, 400);


                $(".configuration").bind("change", refresh);
            });


            function refresh() {
                var chart = $("#chart").data("kendoChart"),
                        pieSeries = chart.options.series[0],
                        labels = $("#labels").prop("checked"),
                        alignInputs = $("input[name='alignType']"),
                        alignLabels = alignInputs.filter(":checked").val();


                chart.options.transitions = false;
                pieSeries.labels.visible = labels;
                pieSeries.labels.align = alignLabels;


                alignInputs.attr("disabled", !labels);


                chart.refresh();
            }
           
            function onSeriesClick(e) {
                alert("Clicked value: " + e.value);
            }
        </script>

4 Answers, 1 is accepted

Sort by
0
Accepted
Iliana Dyankova
Telerik team
answered on 07 Mar 2012, 02:09 PM
Hi,

I have tested onSeriesClick function and it works as expected, but you need to hook up it on seriesClick event.
For example:
$("#chart").kendoChart({
   ...
 seriesClick: onSeriesClick
});


Kind regards,
Iliana Nikolova
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Sam
Top achievements
Rank 1
answered on 07 Mar 2012, 02:45 PM
That helped, thanks for that.
0
Sam
Top achievements
Rank 1
answered on 07 Mar 2012, 03:06 PM
Is there a way to capture the click event for each individual slice on the pie chart?
0
Iliana Dyankova
Telerik team
answered on 12 Mar 2012, 08:31 AM
Hi Sam,

I just answered to your question in the other forum thread


 

Greetings,
Iliana Nikolova
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Charts
Asked by
Sam
Top achievements
Rank 1
Answers by
Iliana Dyankova
Telerik team
Sam
Top achievements
Rank 1
Share this question
or