Client: chart update (area instead of line for elevation)
This commit is contained in:
parent
4219393341
commit
66343c16b8
@ -2,7 +2,7 @@ import { format } from 'date-fns'
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { connect } from 'react-redux'
|
import { connect } from 'react-redux'
|
||||||
import {
|
import {
|
||||||
Line, LineChart, ResponsiveContainer, Tooltip, XAxis, YAxis
|
Area, ComposedChart, Line, ResponsiveContainer, Tooltip, XAxis, YAxis
|
||||||
} from 'recharts'
|
} from 'recharts'
|
||||||
|
|
||||||
import { getActivityChartData } from '../../../actions/activities'
|
import { getActivityChartData } from '../../../actions/activities'
|
||||||
@ -75,7 +75,7 @@ class ActivityCharts extends React.Component {
|
|||||||
</div>
|
</div>
|
||||||
<div className="row chart">
|
<div className="row chart">
|
||||||
<ResponsiveContainer height={300}>
|
<ResponsiveContainer height={300}>
|
||||||
<LineChart
|
<ComposedChart
|
||||||
data={chartData}
|
data={chartData}
|
||||||
margin={{ top: 15, right: 30, left: 20, bottom: 15 }}
|
margin={{ top: 15, right: 30, left: 20, bottom: 15 }}
|
||||||
>
|
>
|
||||||
@ -97,28 +97,31 @@ class ActivityCharts extends React.Component {
|
|||||||
label={{ value: 'altitude (m)', angle: -90, position: 'right' }}
|
label={{ value: 'altitude (m)', angle: -90, position: 'right' }}
|
||||||
yAxisId="right" orientation="right"
|
yAxisId="right" orientation="right"
|
||||||
/>
|
/>
|
||||||
|
<Area
|
||||||
|
yAxisId="right"
|
||||||
|
type="linear"
|
||||||
|
dataKey="elevation"
|
||||||
|
fill="#e5e5e5"
|
||||||
|
stroke="#cccccc"
|
||||||
|
dot={false}
|
||||||
|
/>
|
||||||
<Line
|
<Line
|
||||||
yAxisId="left"
|
yAxisId="left"
|
||||||
type="linear"
|
type="linear"
|
||||||
dataKey="speed"
|
dataKey="speed"
|
||||||
stroke="#8884d8"
|
stroke="#8884d8"
|
||||||
dot={false}
|
strokeWidth={2}
|
||||||
/>
|
|
||||||
<Line
|
|
||||||
yAxisId="right"
|
|
||||||
type="linear"
|
|
||||||
dataKey="elevation"
|
|
||||||
stroke="#808080"
|
|
||||||
dot={false}
|
dot={false}
|
||||||
/>
|
/>
|
||||||
<Tooltip
|
<Tooltip
|
||||||
labelFormatter={value => displayDistance
|
labelFormatter={value => displayDistance
|
||||||
? `${value} km`
|
? `distance: ${value} km`
|
||||||
: format(value, 'HH:mm:ss')}
|
: `duration: ${format(value, 'HH:mm:ss')}`}
|
||||||
/>
|
/>
|
||||||
</LineChart>
|
</ComposedChart>
|
||||||
</ResponsiveContainer>
|
</ResponsiveContainer>
|
||||||
</div>
|
</div>
|
||||||
|
<div className="chart-info">data from gpx, without any cleaning</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -95,6 +95,7 @@ class ActivityDisplay extends React.Component {
|
|||||||
<div className="card-body">
|
<div className="card-body">
|
||||||
<div className="row">
|
<div className="row">
|
||||||
<div className="col">
|
<div className="col">
|
||||||
|
<div className="chart-title">Chart</div>
|
||||||
<ActivityCharts activity={activity} />
|
<ActivityCharts activity={activity} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -100,6 +100,11 @@ input, textarea {
|
|||||||
font-size: 0.9em;
|
font-size: 0.9em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.chart-info {
|
||||||
|
font-size: 0.8em;
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
.chart-radio {
|
.chart-radio {
|
||||||
display: flex;
|
display: flex;
|
||||||
font-size: 0.8em;
|
font-size: 0.8em;
|
||||||
@ -113,6 +118,11 @@ input, textarea {
|
|||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.chart-title {
|
||||||
|
font-size: 1.1em;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
.custom-modal {
|
.custom-modal {
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
|
Loading…
Reference in New Issue
Block a user