0
我正在使用折线图来显示x轴上的时间值和y轴上的车辆速度,并且这两个值都需要来自api。截至目前我使用静态值一样,如何将动态值作为线形图中的数据传递给对象?
playback.component.ts:
import { Component } from '@angular/core';
@Component({
selector: 'app-play-back',
templateUrl: './play-back.component.html'
})
export class PlayBackComponent {
// lineChart
public lineChartData:Array<any> = [
{data: [65, 59, 80, 81, 56, 55], label: 'travelled details'}
];
public lineChartLabels:Array<any> = ['12:00 AM', '4:00 AM', '8:00 AM', '12:00 PM', '4:00 PM', '8:00 PM'];
public lineChartOptions:any = {
responsive: true
};
public lineChartLegend:boolean = true;
public lineChartType:string = 'line';
}
而是在数据和标签这个静态值,我必须从API,它是在传递动态值对象的形式。这些值存储在图表细节作为图像中,
我传递整数作为数据值现在在静态的,而是实际上我需要从API传递数据内的对象,从图表细节对象x轴的fixTime值和y轴的速度值。请帮我解决这个问题。