【发布时间】:2019-10-05 22:55:30
【问题描述】:
我正在使用 ng2-charts 以角度显示折线图。 X 轴只显示几个标签,以免拥挤。
但 y 轴显示所有值。图表如下所示。
是否可以只显示那些显示 x 轴标签的 y 值?
我的代码
labels = ['JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC'];
chartData = [
{
fill: false,
data: [21, 22, 24, 21, 21, 22, 23, 24, 23, 22, 24, 25],
borderColor : 'black',
pointBackgroundColor: 'black',
pointHoverBackgroundColor: '#fff',
pointBorderColor: '#0062ff',
pointHoverBorderColor: 'red',
}
];
updateChartData(){
console.log('in update chart data')
console.log('temp values' + this.temperatureArray)
this.chartData1[0].data = this.temperatureArray
this.labels = this.timeArray
}
当我更新图表数据时,标签(X 值)和 y 值的数量会增加
【问题讨论】:
标签: angular linechart ng2-charts