Angular 9 图表 js mutibar

问题描述 投票:0回答:0

我在我的

chart js
应用程序中实现了
angular 9
。期望图表值不会出现。

ngOnInit:

ngOnInit(): void {

        this.smdashboardservice.fetchSmDashboardData().subscribe(response=>{
      
                //let data = response.data
                let data = [
                        {"label":"Application","sublabel":"Nice","count":2},
                        {"label":"Application","sublabel":"poor","count":1},
                        {"label":"Channels","sublabel":"Quality","count":2},
                        {"label":"Customer Care","sublabel":"support","count":2}
                ]
             
                this.barChartLabels = Object.keys(data);
                this.barChartLabels.forEach(label => {
                        this.barChartData[0].data.push(data[label]['count']);
                });
      
        })
}

当前代码给出图表

但我很期待

这里演示

javascript angular charts chart.js
© www.soinside.com 2019 - 2024. All rights reserved.