Reputation: 1501
Please I have the following code
@model System.Collections.Generic.IEnumerable<CellMinistry.CampusMinistry.Models.Domain.Charting_Models.MemberDistributionModel>
@{
var memberCount = ViewBag.MemberCount is int ? (int) ViewBag.MemberCount : 0;
}
@(Html.Kendo().Chart(Model)
.Name("chart")
.Legend(legend => legend
.Position(ChartLegendPosition.Bottom)
)
.Series(series => series.Pie(
model => model.Value,
model => model.Name,
null,
null // Color expression is omitted
).Labels(c => c.Visible(true).Template("#= kendo.format('{0:P}', percentage)#"))).Title(String.Format("Total Members: {0}", memberCount))
.Tooltip(tooltip => tooltip.Visible(true).Format("{0:N0}")
))
where Model data is from database and dynamically generated.
Anyways, The colors of the generated sections are somewhat alike and I cant find any docmentation as to how to customize them.
I dont want to include the colors in Model
Kind regards
Upvotes: 1
Views: 4386
Reputation: 1037
Try and use the seriesColors property.
@model System.Collections.Generic.IEnumerable<CellMinistry.CampusMinistry.Models.Domain.Charting_Models.MemberDistributionModel>
@{
var memberCount = ViewBag.MemberCount is int ? (int) ViewBag.MemberCount : 0;
}
@(Html.Kendo().Chart(Model)
.Name("chart")
.Legend(legend => legend
.Position(ChartLegendPosition.Bottom)
)
.Series(series => series.Pie(
model => model.Value,
model => model.Name,
null,
null // Color expression is omitted
).Labels(c => c.Visible(true).Template("#= kendo.format('{0:P}', percentage)#"))).Title(String.Format("Total Members: {0}", memberCount))
.SeriesColors("red", "blue", "yellow", "#006634", "#c72e15")
.Tooltip(tooltip => tooltip.Visible(true).Format("{0:N0}")
))
Upvotes: 4