Fixed yAxisID for altitude.
This commit is contained in:
parent
2e6f1b9d53
commit
e68fd8303c
1 changed files with 5 additions and 3 deletions
|
@ -122,6 +122,7 @@ export default {
|
||||||
borderColor: '#5959a8',
|
borderColor: '#5959a8',
|
||||||
fill: false,
|
fill: false,
|
||||||
data: this.points.map((point: GPSPoint) => point.altitude),
|
data: this.points.map((point: GPSPoint) => point.altitude),
|
||||||
|
yAxisID: 'meters',
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -129,11 +130,11 @@ export default {
|
||||||
if (this.showMetrics.distance) {
|
if (this.showMetrics.distance) {
|
||||||
datasets.push(
|
datasets.push(
|
||||||
{
|
{
|
||||||
label: 'Distance (m)',
|
label: 'Distance (' + (this.showMetrics.altitude ? '' : 'k') + 'm)',
|
||||||
backgroundColor: '#f87979',
|
backgroundColor: '#f87979',
|
||||||
borderColor: '#a85959',
|
borderColor: '#a85959',
|
||||||
fill: false,
|
fill: false,
|
||||||
data: this.distances,
|
data: this.showMetrics.altitude ? this.distances : this.distances.map((distance: number) => distance / 1000),
|
||||||
yAxisID: 'meters',
|
yAxisID: 'meters',
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -171,6 +172,7 @@ export default {
|
||||||
text.push('Distance')
|
text.push('Distance')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const unit = this.showMetrics.altitude ? 'm' : 'km'
|
||||||
yAxes.meters = {
|
yAxes.meters = {
|
||||||
type: 'linear',
|
type: 'linear',
|
||||||
position: 'left',
|
position: 'left',
|
||||||
|
@ -180,7 +182,7 @@ export default {
|
||||||
},
|
},
|
||||||
title: {
|
title: {
|
||||||
display: true,
|
display: true,
|
||||||
text: text.join(' / ') + ' (m)',
|
text: text.join(' / ') + ` (${unit})`,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue