Reputation: 561
Is there a way to specify kendo pie chart series colours dynamically? I understand we can specify the colours on the chart initialisation like this:
seriesColors: ["#4C9486", "#E86F5E", "#FFD266", "#E6321B", "#8A8F84", "#D86B00", "#F47787"]
But I want to do this based on the data fields, i.e. have specific colours for specific fields. Any suggestions?
Thanks in advance.
Upvotes: 1
Views: 2247
Reputation: 1719
You can use the configuration option series.colorField
. http://docs.telerik.com/kendo-ui/api/javascript/dataviz/ui/chart#configuration-series.colorField
A simple example.
<div id="chart"></div>
<script>
$("#chart").kendoChart({
series: [{
colorField: "valueColor",
data: [
{ value: 1, valueColor: "red" },
{ value: 2, valueColor: "green" }
]
}]
});
</script>
Upvotes: 2