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

Pie Explode

0 Answers 78 Views
Charts
This is a migrated thread and some comments may be shown as answers.
Philip Senechal
Top achievements
Rank 1
Philip Senechal asked on 04 Sep 2012, 06:41 PM
Hello...I'm using the Razor syntax for creating my pie chart and am having problems figuring out how to explode a slice using a databound pie chart. Here is the code that I thought would work...the object that is feeding the Pie has 2 attributes: Label holds the name and Value holds the value.
@(Html.Kendo().Chart<InfoSource.Requests.Models.Graph>()
                            .Name("myallocation")
                            .Title(title => title
                                .Text("MY ALLOCATION")
                                .Font("16px Oswald")
                            )
                            .Theme("Silver")
                            .Legend(legend => legend
                                .Visible(false)
                            )
                            .ChartArea(chartArea => chartArea
                                .Background("transparent")
                            )
                            .DataSource(ds => ds
                                .Read(read => read.Action("dMyAllocation", "Dashboard", new { area = "InfoSource.Metrics" }))
                            )
                            .Series(series => {
                                series.Pie(model => model.Value, model => model.Label, null, model => model.Label == "Unassigned" ? true : false)
                                    .Labels(labels => labels
                                        .Template("${dataItem.Label}")
                                        .Visible(true).Position(ChartPieLabelsPosition.InsideEnd)
                                    );
                            })
                            .Events(events => events
                                .SeriesClick("myallocationClick")
                            )
                            .Tooltip(tooltip => tooltip
                                .Visible(true)
                                    .Template("${dataItem.Label} - ${value}%")
                            )
                            .HtmlAttributes(new { style = "max-height: 300px;" })
                        )

From what I can understand, the series syntax includes on option for true/false if the pie should explode or not. I have set mine up using the Label text so that if the Label text is "Unassigned", the pie piece should explode. This is not happening however.

Can you let me know if my syntax is correct or not? Thanks.

No answers yet. Maybe you can help?

Tags
Charts
Asked by
Philip Senechal
Top achievements
Rank 1
Share this question
or