【发布时间】:2021-11-06 15:55:53
【问题描述】:
数据集有值 10 和 50000,它不能在图表的 2006 列中显示值为 10 的条形图,因为它是图表比例最小的。谁能帮我展示一下?
public barChartOptions: ChartOptions = {
responsive: true,
scales: { //you're missing this
yAxes: [{
scaleLabel: {
display: true,
labelString: 'Frequency Rate'
},
ticks: { // and this
callback: function(value, index, values) {
return value/1000 + 'k';
}
}
}]
}
};
public barChartLabels: Label[] = ['2006', '2007', '2008', '2009', '2010', '2011', '2012'];
public barChartType: ChartType = 'bar';
public barChartLegend = true;
public barChartPlugins = [];
public barChartData: ChartDataSets[] = [
{ data: [6500, 5900, 8000, 8100, 5600, 5500, 4000], label: 'Series A' },
{ data: [10, 4800, 4000, 1900, 8600, 2700, 50000], label: 'Series B' }
];
You can see Chart in this image
您可以在此处查看完整代码: a link!
【问题讨论】:
标签: angular typescript ng2-charts