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.
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.
@(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.