Merge pull request #330 from jat255/fix_detail_chart_units
Fix detail chart units
This commit is contained in:
commit
12950358ef
@ -36,7 +36,9 @@ export const getDatasets = (
|
|||||||
const coordinates: TCoordinates[] = []
|
const coordinates: TCoordinates[] = []
|
||||||
|
|
||||||
chartData.map((data) => {
|
chartData.map((data) => {
|
||||||
distance_labels.push(data.distance)
|
distance_labels.push(
|
||||||
|
convertStatsDistance('km', data.distance, useImperialUnits)
|
||||||
|
)
|
||||||
duration_labels.push(data.duration)
|
duration_labels.push(data.duration)
|
||||||
datasets.speed.data.push(
|
datasets.speed.data.push(
|
||||||
convertStatsDistance('km', data.speed, useImperialUnits)
|
convertStatsDistance('km', data.speed, useImperialUnits)
|
||||||
|
@ -54,37 +54,37 @@ describe('getDatasets', () => {
|
|||||||
time: 'Sun, 12 Sep 2021 13:29:24 GMT',
|
time: 'Sun, 12 Sep 2021 13:29:24 GMT',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
distance: 0,
|
distance: 0.66,
|
||||||
duration: 1,
|
duration: 493.855,
|
||||||
elevation: 83.7,
|
elevation: 95.4,
|
||||||
latitude: 48.845578,
|
latitude: 48.846386,
|
||||||
longitude: 2.373732,
|
longitude: 2.379495,
|
||||||
speed: 1.56,
|
speed: 20.64,
|
||||||
time: 'Sun, 12 Sep 2021 13:29:25 GMT',
|
time: 'Sun, 12 Sep 2021 13:37:38 GMT',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
distance: 0.01,
|
distance: 1.25,
|
||||||
duration: 96,
|
duration: 637.864,
|
||||||
elevation: 84.3,
|
elevation: 91.1,
|
||||||
latitude: 48.845591,
|
latitude: 48.84733,
|
||||||
longitude: 2.373811,
|
longitude: 2.387452,
|
||||||
speed: 14.73,
|
speed: 13.03,
|
||||||
time: 'Sun, 12 Sep 2021 13:31:00 GMT',
|
time: 'Sun, 12 Sep 2021 13:40:02 GMT',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
locale: 'en',
|
locale: 'en',
|
||||||
useImperialUnits: false,
|
useImperialUnits: false,
|
||||||
},
|
},
|
||||||
expected: {
|
expected: {
|
||||||
distance_labels: [0, 0, 0.01],
|
distance_labels: [0, 0.66, 1.25],
|
||||||
duration_labels: [0, 1, 96],
|
duration_labels: [0, 493.855, 637.864],
|
||||||
datasets: {
|
datasets: {
|
||||||
speed: {
|
speed: {
|
||||||
label: 'speed',
|
label: 'speed',
|
||||||
backgroundColor: ['#FFFFFF'],
|
backgroundColor: ['#FFFFFF'],
|
||||||
borderColor: ['#8884d8'],
|
borderColor: ['#8884d8'],
|
||||||
borderWidth: 2,
|
borderWidth: 2,
|
||||||
data: [2.89, 1.56, 14.73],
|
data: [2.89, 20.64, 13.03],
|
||||||
yAxisID: 'ySpeed',
|
yAxisID: 'ySpeed',
|
||||||
},
|
},
|
||||||
elevation: {
|
elevation: {
|
||||||
@ -93,14 +93,14 @@ describe('getDatasets', () => {
|
|||||||
borderColor: ['#cccccc'],
|
borderColor: ['#cccccc'],
|
||||||
borderWidth: 1,
|
borderWidth: 1,
|
||||||
fill: true,
|
fill: true,
|
||||||
data: [83.6, 83.7, 84.3],
|
data: [83.6, 95.4, 91.1],
|
||||||
yAxisID: 'yElevation',
|
yAxisID: 'yElevation',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
coordinates: [
|
coordinates: [
|
||||||
{ latitude: 48.845574, longitude: 2.373723 },
|
{ latitude: 48.845574, longitude: 2.373723 },
|
||||||
{ latitude: 48.845578, longitude: 2.373732 },
|
{ latitude: 48.846386, longitude: 2.379495 },
|
||||||
{ latitude: 48.845591, longitude: 2.373811 },
|
{ latitude: 48.84733, longitude: 2.387452 },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -118,37 +118,37 @@ describe('getDatasets', () => {
|
|||||||
time: 'Sun, 12 Sep 2021 13:29:24 GMT',
|
time: 'Sun, 12 Sep 2021 13:29:24 GMT',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
distance: 0,
|
distance: 0.66,
|
||||||
duration: 1,
|
duration: 493.855,
|
||||||
elevation: 83.7,
|
elevation: 95.4,
|
||||||
latitude: 48.845578,
|
latitude: 48.846386,
|
||||||
longitude: 2.373732,
|
longitude: 2.379495,
|
||||||
speed: 1.56,
|
speed: 20.64,
|
||||||
time: 'Sun, 12 Sep 2021 13:29:25 GMT',
|
time: 'Sun, 12 Sep 2021 13:37:38 GMT',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
distance: 0.01,
|
distance: 1.25,
|
||||||
duration: 96,
|
duration: 637.864,
|
||||||
elevation: 84.3,
|
elevation: 91.1,
|
||||||
latitude: 48.845591,
|
latitude: 48.84733,
|
||||||
longitude: 2.373811,
|
longitude: 2.387452,
|
||||||
speed: 14.73,
|
speed: 13.03,
|
||||||
time: 'Sun, 12 Sep 2021 13:31:00 GMT',
|
time: 'Sun, 12 Sep 2021 13:40:02 GMT',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
locale: 'en',
|
locale: 'en',
|
||||||
useImperialUnits: true,
|
useImperialUnits: true,
|
||||||
},
|
},
|
||||||
expected: {
|
expected: {
|
||||||
distance_labels: [0, 0, 0.01],
|
distance_labels: [0, 0.41, 0.78],
|
||||||
duration_labels: [0, 1, 96],
|
duration_labels: [0, 493.855, 637.864],
|
||||||
datasets: {
|
datasets: {
|
||||||
speed: {
|
speed: {
|
||||||
label: 'speed',
|
label: 'speed',
|
||||||
backgroundColor: ['#FFFFFF'],
|
backgroundColor: ['#FFFFFF'],
|
||||||
borderColor: ['#8884d8'],
|
borderColor: ['#8884d8'],
|
||||||
borderWidth: 2,
|
borderWidth: 2,
|
||||||
data: [1.8, 0.97, 9.15],
|
data: [1.8, 12.83, 8.1],
|
||||||
yAxisID: 'ySpeed',
|
yAxisID: 'ySpeed',
|
||||||
},
|
},
|
||||||
elevation: {
|
elevation: {
|
||||||
@ -157,14 +157,14 @@ describe('getDatasets', () => {
|
|||||||
borderColor: ['#cccccc'],
|
borderColor: ['#cccccc'],
|
||||||
borderWidth: 1,
|
borderWidth: 1,
|
||||||
fill: true,
|
fill: true,
|
||||||
data: [274.28, 274.61, 276.57],
|
data: [274.28, 312.99, 298.88],
|
||||||
yAxisID: 'yElevation',
|
yAxisID: 'yElevation',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
coordinates: [
|
coordinates: [
|
||||||
{ latitude: 48.845574, longitude: 2.373723 },
|
{ latitude: 48.845574, longitude: 2.373723 },
|
||||||
{ latitude: 48.845578, longitude: 2.373732 },
|
{ latitude: 48.846386, longitude: 2.379495 },
|
||||||
{ latitude: 48.845591, longitude: 2.373811 },
|
{ latitude: 48.84733, longitude: 2.387452 },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user