I have got some data from externel API using http get request. The code is this,
export class ProfileComponent implements OnInit {
weather: IWeather[];
constructor(private _weather: WeatherService) { }
ngOnInit(): void {
this._weather.getWeather().subscribe(data => {
this.weather = data
})
}
}
The array type is IWeather which I have implemented before.It is like this,
export interface IWeather{
sensor_id:String;
date:String;
data_value:String;
}
Now the thing is, I need to draw a chart using Chart.js using this data from the api(weather array). I need the key date in the X axis and the key data_value in Y axis. How to get these array values to a line chart?
please help me with an example of line chart. I am a beginner in web development.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…