Angular9Chart.jsstackedbarchartwithmultiplebars
创始人
2024-10-22 16:30:10
0

首先是中文的翻译: 使用Angular 9和Chart.js制作多个堆叠柱状图

然后给出代码示例: HTML文件:

TS文件:

import { Component, OnInit } from '@angular/core';
import { ChartDataSets, ChartOptions, ChartType } from 'chart.js';
import { Label } from 'ng2-charts';

@Component({
  selector: 'app-bar-chart',
  templateUrl: './bar-chart.component.html',
  styleUrls: ['./bar-chart.component.css']
})
export class BarChartComponent implements OnInit {

  constructor() { }

  ngOnInit() {
  }

  barChartOptions: ChartOptions = {
    responsive: true,
    scales: {
      xAxes: [{
        stacked: true,
      }],
      yAxes: [{
        stacked: true,
        ticks: {
          beginAtZero: true,
        }
      }]
    }
  };

  barChartLabels: Label[] = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];

  barChartType: ChartType = 'bar';

  barChartLegend = true;

  barChartData: ChartDataSets[] = [
    { data: [65, 59, 80, 81, 56, 55, 40, 30, 20, 10, 15, 35], label: 'Series A' },
    { data: [28, 48, 40, 35, 43, 50, 60, 70, 80, 90, 100, 120], label: 'Series B' },
    { data: [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120], label: 'Series C' }
  ];

}

相关内容

热门资讯

透视app!德州透视插件(透视... 透视app!德州透视插件(透视)hhpoker辅助器(真是有透视)-哔哩哔哩1、在德州透视插件插件功...
透视攻略!拱趴大菠萝有挂吗(透... 透视攻略!拱趴大菠萝有挂吗(透视)pokemmo手机版透视脚本(总是是有辅助器)-哔哩哔哩1、不需要...
透视脚本!欢聚水鱼脚本(辅助)... 您好,jj斗地主捕鱼辅助这款游戏可以开挂的,确实是有挂的,需要了解加去威信【485275054】很多...
透视软件!hhpoker作必弊... 透视软件!hhpoker作必弊实战视频(透视)hhpoker透视脚本下载(其实存在有脚本)-哔哩哔哩...
透视方法!wepoker透视脚... 透视方法!wepoker透视脚本免费使用视频(透视)wepoker怎么提高运气(确实一直总是有挂)-...
透视app!HH平台挂(透视)... 透视app!HH平台挂(透视)hhpoker脚本下载(一贯一直总是有挂)-哔哩哔哩亲,关键说明,hh...
透视技巧!德扑圈透视(透视)德... 透视技巧!德扑圈透视(透视)德扑圈透视挂(其实是真的有脚本)-哔哩哔哩1、德扑圈透视挂公共底牌简单,...
透视神器!聚星ai辅助工具激活... 透视神器!聚星ai辅助工具激活码(透视)sohoopoker辅助(原来存在有脚本)-哔哩哔哩1、上手...
透视插件!德普软件(透视)德普... 透视插件!德普软件(透视)德普之星有透视辅助吗(其实存在有脚本)-哔哩哔哩运德普之星有透视辅助吗辅助...
透视插件!aapoker插件下... 透视插件!aapoker插件下载(透视)aapoker怎么控制牌(切实存在有脚本)-哔哩哔哩1、下载...