【发布时间】:2019-09-11 09:24:27
【问题描述】:
我有条形图,我想在这个条形图上画平均线。
我的解决方案:
在数据集中,我添加类型为'line'的元素:
https://stackblitz.com/edit/ng2-charts-bar-template?file=src%2Fapp%2Fapp.component.ts
public barChartLabels: Label[] = ['2006', '2007', '2008', '2009', '2010', '2011', '2012'];
public barChartType: ChartType = 'bar';
public barChartLegend = true;
public barChartPlugins = [];
public barChartData: ChartDataSets[] =
[
{ data: [65, 59, 80, 81, 56, 55, 40], label: 'Series A' },
{ data: [28, 48, 40, 19, 86, 27, 90], label: 'Series B' },
**{ data: [48, 48, 48, 48, 48, 48, 48], label: 'Series C', type: '*line*' }**
];
【问题讨论】:
标签: angular bar-chart linechart ng2-charts chartjs-2.6.0