fix charts y coordinates
Gitea Actions Demo / build_and_push (push) Has been cancelled Details

This commit is contained in:
artem 2025-02-01 09:55:58 +03:00
parent 7c12da31af
commit 74467d1c7b
2 changed files with 19 additions and 5 deletions

View File

@ -51,16 +51,16 @@ export const GetWorkout = (url: string) => {
mapCenter = [coords[0][0], coords[0][1]];
let datasets = [];
if (speed.length > 0) {
datasets.push({ radius: 0, label: 'Скорость', borderColor: '#00aa00', backgroundColor: '#00aa00', data: speed });
datasets.push({yAxisID: 'linear-y-axis', radius: 0, label: 'Скорость', borderColor: '#00aa00', backgroundColor: '#00aa00', data: speed });
}
if (heart_rate.length > 0) {
datasets.push({ radius: 0, label: 'Пульс', borderColor: '#990000', backgroundColor: '#990000', data: heart_rate, });
datasets.push({yAxisID: 'linear-y-axis', radius: 0, label: 'Пульс', borderColor: '#990000', backgroundColor: '#990000', data: heart_rate, });
}
if (power.length > 0) {
datasets.push({ radius: 0, label: 'Мощность', borderColor: '#cccccc', backgroundColor: '#cccccc', data: power, });
datasets.push({yAxisID: 'log-y-axis', radius: 0, label: 'Мощность', borderColor: '#cccccc', backgroundColor: '#cccccc', data: power, });
}
if (elevation.length > 0) {
datasets.push( { radius: 0, label: 'Подъем', borderColor: '#000', backgroundColor: '#000', data: elevation, });
datasets.push( {yAxisID: 'linear-y-ground', radius: 0, label: 'Подъем', borderColor: '#000', backgroundColor: '#000', data: elevation, });
}
data = {
labels: times,

View File

@ -235,7 +235,20 @@ const chartPlugins = [
const chartOptions = {
responsive: true,
scales: {
y: {
type: 'linear',
display: false,
position: 'left',
id: 'linear-y-axis',
},
yGroung: {
type: 'linear',
display: false,
position: 'left',
id: 'linear-y-ground',
},
yAxes: {
display: false,
type: 'logarithmic',
position: 'right',
stacked: false,
@ -244,7 +257,8 @@ const chartOptions = {
},
gridLines: {
display: true
}
},
id: 'log-y-axis',
},
x: {
type: 'time',