对于剑道图表,当我将对象值与 'categoryField' 绑定时,图表无法正确渲染
我在这里用条形图演示了这一点: https://stackblitz.com/edit/angular-oykufy
以下是我所做的一些更改,可以正确呈现您的图表。
更新系列数据
public seriesData: any[] = [
{
value: 'Chai' ,
sales: 200,
},
{
value: 'Others' ,
sales: 250,
},
];
删除了 kendo-chart-category-axis-item-labels 并将其替换为 kendo-chart-category-axis-item。这就是您的新模板的样子。
template: `
<kendo-chart (seriesClick)="onClickEve($event)">
<kendo-chart-series>
<kendo-chart-series-item
type="column" [data]="seriesData"
field="sales" categoryField="value">
</kendo-chart-series-item>
</kendo-chart-series>
<kendo-chart-category-axis >
<kendo-chart-category-axis-item >
<kendo-chart-category-axis-item rotation="auto" [categories]="value">
</kendo-chart-category-axis-item>
</kendo-chart-category-axis-item>
</kendo-chart-category-axis>
</kendo-chart>
`,