简体   繁体   English

如何在 kendo ui angular 中创建堆栈条形图

[英]How to create stack bar chart in kendo ui angular

I'm new to angular and I'm trying to create stack bar charts using kendo UI.我是 angular 的新手,我正在尝试使用 kendo UI 创建堆栈条形图。 I'm getting normal bar rather than stack bar chart, used stack="true" also not getting the view in stack.我得到的是普通条形图而不是堆栈条形图,使用stack="true"也没有得到堆栈中的视图。

Here is my code:这是我的代码:

app.component.html app.component.html

<kendo-chart style="height: 150px;">
    <kendo-chart-legend position="bottom" orientation="horizontal" [visible]="true"></kendo-chart-legend>

    <kendo-chart-area background="#F2FAFD"></kendo-chart-area>

    <kendo-chart-series>
        <kendo-chart-series-item type="column" *ngFor="let item of currentFindingsData" [data]="item.items" [name]="item.value" [stack]="true">

        </kendo-chart-series-item>
    </kendo-chart-series>
</kendo-chart>

app.component.ts应用程序组件.ts

public currentFindingsJson: GroupResult[] = [{
    Value: "3"
    color: "#2E75B5"
    status: "CAT2 (Minor)"    
}, {
    Value: "10"
    color: "#2E75B5"
    status: "CAT1 (Minor)"
}];

this.currentFindingsData = groupBy(currentFindingsJson, [{field: 'status'}]) as GroupResult[];

You need to specify [stack]="{ type: '100%' }" .您需要指定[stack]="{ type: '100%' }"

Check this document link - https://www.telerik.com/kendo-angular-ui/components/charts/series-types/bar/#toc-100-stacked-bar检查此文档链接 - https://www.telerik.com/kendo-angular-ui/components/charts/series-types/bar/#toc-100-stacked-bar

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM