fix null in showing
Gitea Actions Demo / build_and_push (push) Successful in 1m16s Details

This commit is contained in:
artem 2024-12-02 19:34:58 +03:00
parent a158abb69f
commit ad568cd9bb
1 changed files with 14 additions and 6 deletions

View File

@ -253,14 +253,22 @@ const initWorkout = (id: string) => {
} }
lineCoordinates.value = coords lineCoordinates.value = coords
mapCenter.value = [coords[0][0], coords[0][1]]; mapCenter.value = [coords[0][0], coords[0][1]];
let datasets = [];
if (speed) {
datasets.push({ radius: 0, label: 'Скорость', borderColor: '#00aa00', backgroundColor: '#00aa00', data: speed });
}
if (heart_rate) {
datasets.push({ radius: 0, label: 'Пульс', borderColor: '#990000', backgroundColor: '#990000', data: heart_rate, });
}
if (power) {
datasets.push({ radius: 0, label: 'Мощность', borderColor: '#cccccc', backgroundColor: '#cccccc', data: power, });
}
if (elevation) {
datasets.push( { radius: 0, label: 'Подъем', borderColor: '#000', backgroundColor: '#000', data: elevation, });
}
data.value = { data.value = {
labels: times, labels: times,
datasets: [ datasets: datasets
{ radius: 0, label: 'Скорость', borderColor: '#00aa00', backgroundColor: '#00aa00', data: speed },
{ radius: 0, label: 'Пульс', borderColor: '#990000', backgroundColor: '#990000', data: heart_rate, },
{ radius: 0, label: 'Мощность', borderColor: '#cccccc', backgroundColor: '#cccccc', data: power, },
{ radius: 0, label: 'Подъем', borderColor: '#000', backgroundColor: '#000', data: elevation, },
]
} }
}) })