OpenWeather: add description in chart
This commit is contained in:
parent
240ace2ced
commit
cb5c6ccb22
|
@ -53,10 +53,11 @@ export default {
|
|||
},
|
||||
tooltips: {
|
||||
intersect: false,
|
||||
mode: 'index',
|
||||
callbacks: {
|
||||
title(tooltipItem: any, myData: any) {
|
||||
const item = myData.datasets[tooltipItem[0].datasetIndex].data[tooltipItem[0].index]
|
||||
return moment(item.x || item.t).format('HH[h]')
|
||||
title(tooltipItems: any, myData: any) {
|
||||
const item = myData.datasets[tooltipItems[0].datasetIndex].data[tooltipItems[0].index]
|
||||
return moment(item.x || item.t).format('HH[h]') + (item.d ? ` - ${item.d}` : '')
|
||||
},
|
||||
label(tooltipItem: any, myData: any) {
|
||||
let label = myData.datasets[tooltipItem.datasetIndex].label || ''
|
||||
|
|
|
@ -44,6 +44,9 @@ interface Forecast {
|
|||
rain?: {
|
||||
'3h': number
|
||||
}
|
||||
weather: Array<{
|
||||
description: string
|
||||
}>,
|
||||
}
|
||||
|
||||
const AUTH = { TOKEN: 'token' }
|
||||
|
@ -83,9 +86,9 @@ export default class OpenWeatherMap extends ConnectedService<object, object> {
|
|||
borderWidth: 1,
|
||||
fill: false,
|
||||
data: fs.map(line => ({
|
||||
x: line.dt * 1000, y: line.main.temp
|
||||
x: line.dt * 1000, y: line.main.temp, d: line.weather[0].description
|
||||
}))
|
||||
},{
|
||||
}, {
|
||||
type: 'bar',
|
||||
label: 'Percipitation',
|
||||
yAxisID: 'y-axis-rain',
|
||||
|
|
Loading…
Reference in New Issue