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

Explode slices onSeriesClick

5 Answers 356 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, 03:21 PM
Is there a way to make the slices in a pie chart explode onClick event?

5 Answers, 1 is accepted

Sort by
0
Iliana Dyankova
Telerik team
answered on 07 Mar 2012, 05:21 PM
Hi Sam,

Series definition contains information about all of the pieces in Kendo UI Pie Chart and I am not sure why do you need  to hook up onClick event on every slice. Could you please give more details about your scenario?


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!
0
Sam
Top achievements
Rank 1
answered on 07 Mar 2012, 05:41 PM
Thanks for your reply, i'm trying to build a custom drill-down chart, so depending on which slice a user clicks it would redirect you to a different report/page etc.
0
Iliana Dyankova
Telerik team
answered on 12 Mar 2012, 08:30 AM
Hello Sam,

You need to define the behavior for the particular slices of Kendo UI Pie Chart using category name in the onSeriesClick function.
For example: 
function onSeriesClick(e) {
    if (e.category == "valueA") {
    //do something
    }
    else if (e.category == "valueB"){
    //do something
    }
    else if (e.category == "valueC"){
    //do something
    }
}

For more convenience I have created a sample project and attached it.

 

All the best,
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
Ä m o l
Top achievements
Rank 2
answered on 17 May 2012, 11:16 AM
Hi Sam

Please check the code give below... for exploding.

 $( "#chart" ).kendoChart( {
            theme: "blueOpal",
            title: {
                text: "Testing"
            },
            legend: {
                position: "left"
            },
            dataSource: {
                data: mainData
            },
            seriesDefaults: {
                labels: {
                    visible: true
                }
            },
            series: [{
                type: "pie",
                field: "percentage",
                categoryField: "source",
                explodeField: "explode"
            }],
            tooltip: {
                visible: true,
                template: "${ category } - ${ value }"
            },
            seriesClick: MainChartSeriesClick
        } );
    }

    MainChartSeriesClick = function ( e )
    {
        $( e.sender.dataSource.options.data ).each( function ( i, item )
        {
            if ( item.source != e.category )
            {
                item.explode = false;
            }
            else
            {
                item.explode = true;
            }
        } );
        createChart();
    }

    $( document ).ready( function ()
    {
        setTimeout( function ()
        {
            createChart();
        }, 100 );
    } );



0
Jim
Top achievements
Rank 1
answered on 02 May 2013, 02:38 PM
@Amol - thanks! 
Tags
Charts
Asked by
Sam
Top achievements
Rank 1
Answers by
Iliana Dyankova
Telerik team
Sam
Top achievements
Rank 1
Ä m o l
Top achievements
Rank 2
Jim
Top achievements
Rank 1
Share this question
or