5 Answers, 1 is accepted
0
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
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
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:
For more convenience I have created a sample project and attached it.
Iliana Nikolova
the Telerik team
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 );
} );
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!