Hi guys,
I have a pie chart that I'm fetching json data from my controller to populate. The json is pretty basic:
[
{
type:
"AddOutageRequest"
,
count: 155
},
{
type:
"AuthorizationRequest"
,
count: 362
},
{
type:
"CurrentOutageRequest"
,
count: 2118
},
{
type:
"PlannedOutageRequest"
,
count: 97
},
{
type:
"RegionRequest"
,
count: 1212
}
]
This is good and I fetch it with my controller method but the labels on the pie chart/legend/etc. are (of course) the same as the "type" field. I want to present it in a more friendly manner so for example show "PlannedOutageRequest" as "Planned Outages" on the chart.
How would I do this in my chart wrapper (as I can't change the backend) or would I have do some javascript after the chart loads?
Here's my chart markup if that helps:
<div class=
"chart-wrapper"
>
@(Html.Kendo().Chart()
.Name(
"serverRequestsByTypeChart"
)
.Legend(legend => legend.Position(ChartLegendPosition.Bottom))
.Series(series =>
{
series
.Pie(
"count"
,
"type"
)
.Labels(labels => labels
.Template(
"#= category #: \n #= value#"
)
.Background(
"transparent"
)
.Visible(
true
)
); ;
})
.DataSource(datasource =>
{
datasource.Read(read => read.Action(
"RequestTypesByTimePeriod"
,
"Data"
));
})
)
</div>
Thanks!