import { Component, OnInit, OnDestroy } from '@angular/core'; @Component({ selector: 'cm-bar-doc-2', templateUrl: './cm-bar-doc-2.component.html', styleUrls: ['./cm-bar-doc-2.component.css'] }) export class CosmosBarDoc2Component implements OnInit, OnDestroy { chartData: any; chartSettings: any; constructor() { this.chartData = { columns: ['日期', '成本', '利润', '占比', '其他'], rows: [ { '成本': 3523, '日期': '1月1日', '利润': 1823, '占比': 0.42, '其他': 900 }, { '成本': 1223, '日期': '1月2日', '利润': 4237, '占比': 0.35, '其他': 750 }, { '成本': 2123, '日期': '1月3日', '利润': 5523, '占比': 0.7, '其他': 680 }, { '成本': 4123, '日期': '1月4日', '利润': 8296, '占比': 0.31, '其他': 320 }, { '成本': 8123, '日期': '1月5日', '利润': 3618, '占比': 0.61, '其他': 500 }, ] }; this.chartSettings = { axisSite: { right: ['占比'] }, yAxisType: ['KMB', 'percent'], yAxisName: ['数值', '比率'] } } ngOnInit() { } ngOnDestroy() { } }