fix speed gapes
Gitea Actions Demo / build_and_push (push) Successful in 1m16s
Details
Gitea Actions Demo / build_and_push (push) Successful in 1m16s
Details
This commit is contained in:
parent
54b3a259f9
commit
aded308184
|
|
@ -31,35 +31,48 @@ export const GetWorkout = (url: string) => {
|
||||||
let power = [];
|
let power = [];
|
||||||
let coords = [];
|
let coords = [];
|
||||||
let elevation = [];
|
let elevation = [];
|
||||||
|
let is_elevation = false;
|
||||||
|
let is_power = false;
|
||||||
|
let is_heart_rate = false;
|
||||||
|
let is_speed = false;
|
||||||
for (let i in response.data.results) {
|
for (let i in response.data.results) {
|
||||||
times.push(response.data.results[i].timestamp);
|
times.push(response.data.results[i].timestamp);
|
||||||
coords.push([response.data.results[i].longitude, response.data.results[i].latitude]);
|
coords.push([response.data.results[i].longitude, response.data.results[i].latitude]);
|
||||||
|
elevation.push(response.data.results[i].elevation);
|
||||||
if (response.data.results[i].elevation !== null) {
|
if (response.data.results[i].elevation !== null) {
|
||||||
elevation.push(response.data.results[i].elevation);
|
is_elevation = true;
|
||||||
|
}
|
||||||
|
power.push(response.data.results[i].power);
|
||||||
|
if (response.data.results[i].power !== null) {
|
||||||
|
is_power = true;
|
||||||
|
}
|
||||||
|
heart_rate.push(response.data.results[i].heart_rate);
|
||||||
|
if (response.data.results[i].heart_rate !== null) {
|
||||||
|
is_heart_rate = true;
|
||||||
}
|
}
|
||||||
if (response.data.results[i].speed !== null) {
|
if (response.data.results[i].speed !== null) {
|
||||||
speed.push(msToKmh(response.data.results[i].speed));
|
speed.push(msToKmh(response.data.results[i].speed));
|
||||||
|
} else {
|
||||||
|
speed.push(null);
|
||||||
}
|
}
|
||||||
if (response.data.results[i].power !== null) {
|
if (response.data.results[i].speed !== null) {
|
||||||
power.push(response.data.results[i].power);
|
is_speed = true;
|
||||||
}
|
|
||||||
if (response.data.results[i].heart_rate !== null) {
|
|
||||||
heart_rate.push(response.data.results[i].heart_rate);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lineCoordinates = coords
|
lineCoordinates = coords
|
||||||
mapCenter = [coords[0][0], coords[0][1]];
|
mapCenter = [coords[0][0], coords[0][1]];
|
||||||
let datasets = [];
|
let datasets = [];
|
||||||
if (speed.length > 0) {
|
if (is_speed) {
|
||||||
datasets.push({yAxisID: 'linearYSpeed', radius: 0, label: 'Скорость', borderColor: '#00aa00', backgroundColor: '#00aa00', data: speed });
|
datasets.push({yAxisID: 'linearYSpeed', radius: 0, label: 'Скорость', borderColor: '#00aa00', backgroundColor: '#00aa00', data: speed });
|
||||||
}
|
}
|
||||||
if (heart_rate.length > 0) {
|
if (is_heart_rate) {
|
||||||
datasets.push({yAxisID: 'linearAxis', radius: 0, label: 'Пульс', borderColor: '#990000', backgroundColor: '#990000', data: heart_rate, });
|
datasets.push({yAxisID: 'linearAxis', radius: 0, label: 'Пульс', borderColor: '#990000', backgroundColor: '#990000', data: heart_rate, });
|
||||||
}
|
}
|
||||||
if (power.length > 0) {
|
if (is_power) {
|
||||||
datasets.push({yAxisID: 'logAxis', radius: 0, label: 'Мощность', borderColor: '#cccccc', backgroundColor: '#cccccc', data: power, });
|
datasets.push({yAxisID: 'logAxis', radius: 0, label: 'Мощность', borderColor: '#cccccc', backgroundColor: '#cccccc', data: power, });
|
||||||
}
|
}
|
||||||
if (elevation.length > 0) {
|
if (is_elevation) {
|
||||||
datasets.push( {yAxisID: 'yGroung', radius: 0, label: 'Подъем', borderColor: '#000', backgroundColor: '#000', data: elevation, });
|
datasets.push( {yAxisID: 'yGroung', radius: 0, label: 'Подъем', borderColor: '#000', backgroundColor: '#000', data: elevation, });
|
||||||
}
|
}
|
||||||
data = {
|
data = {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue