我有一个Kendo for Angular柱形图,可以在其中更改颜色。条形的颜色已更改,但“图例”仍显示默认颜色。有人知道我在想什么吗?
答案 0 :(得分:2)
图例中的颜色与系列的颜色相对应。设置每列的颜色不会更改系列。您需要删除颜色设置,然后设置系列。
您的模板定义应如下所示:
<kendo-chart [seriesColors]="['#4F81BD', '#C0504D']">
<kendo-chart-legend position="top"></kendo-chart-legend>
<kendo-chart-axis-defaults>
<kendo-chart-axis-defaults-labels format="c0"></kendo-chart-axis-defaults-labels>
</kendo-chart-axis-defaults>
<kendo-chart-tooltip format="{0:C}"></kendo-chart-tooltip>
<kendo-chart-series>
<kendo-chart-series-item
*ngFor="let item of detailSeries"
[data]="item.items" [name]="item.value"
field="value" categoryField="service"
type="column">
</kendo-chart-series-item>
</kendo-chart-series>
<kendo-chart-category-axis>
<kendo-chart-category-axis-item>
<kendo-chart-category-axis-item-labels [rotation]="-45"></kendo-chart-category-axis-item-labels>
</kendo-chart-category-axis-item>
</kendo-chart-category-axis>
</kendo-chart>