lewtun HF Staff Claude Opus 4.6 commited on
Commit
5ee1afb
·
1 Parent(s): a3df4ef

Clean up chart labels and unify pain chart colours

Browse files

Remove redundant (km) from Weekly Distance title, capitalise all
Y-axis labels, and use consistent colours across pain charts
(red for During, blue for After).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Files changed (1) hide show
  1. src/components/Charts.js +9 -8
src/components/Charts.js CHANGED
@@ -4,18 +4,19 @@ import {
4
  } from 'recharts';
5
  import './Charts.css';
6
 
 
 
 
7
  const PAIN_CHARTS = [
8
  {
9
  location: 'left_knee',
10
  title: 'Left Knee Pain',
11
- color: '#ef4444',
12
  duringKey: 'left_knee_during',
13
  afterKey: 'left_knee_after',
14
  },
15
  {
16
  location: 'right_knee',
17
  title: 'Right Knee Pain',
18
- color: '#8b5cf6',
19
  duringKey: 'right_knee_during',
20
  afterKey: 'right_knee_after',
21
  },
@@ -46,13 +47,13 @@ function Charts({ data, painData }) {
46
  return (
47
  <div className="charts">
48
  <div className="chart-container card">
49
- <h2>Weekly Distance (km)</h2>
50
  <ResponsiveContainer width="100%" height={300}>
51
  <BarChart data={chartData}>
52
  <CartesianGrid strokeDasharray="3 3" />
53
  <XAxis dataKey="label" />
54
  <YAxis>
55
- <Label value="km" angle={-90} position="insideLeft" style={{ textAnchor: 'middle', fill: '#6b7280' }} />
56
  </YAxis>
57
  <Tooltip />
58
  <Bar dataKey="distance" fill="var(--color-primary)" radius={[4, 4, 0, 0]} />
@@ -66,7 +67,7 @@ function Charts({ data, painData }) {
66
  <CartesianGrid strokeDasharray="3 3" />
67
  <XAxis dataKey="label" />
68
  <YAxis>
69
- <Label value="load" angle={-90} position="insideLeft" style={{ textAnchor: 'middle', fill: '#6b7280' }} />
70
  </YAxis>
71
  <Tooltip />
72
  <Line
@@ -87,7 +88,7 @@ function Charts({ data, painData }) {
87
  <CartesianGrid strokeDasharray="3 3" />
88
  <XAxis dataKey="label" />
89
  <YAxis domain={[0, 10]}>
90
- <Label value="pain" angle={-90} position="insideLeft" style={{ textAnchor: 'middle', fill: '#6b7280' }} />
91
  </YAxis>
92
  <Tooltip />
93
  <Legend />
@@ -95,7 +96,7 @@ function Charts({ data, painData }) {
95
  type="monotone"
96
  dataKey={chart.duringKey}
97
  name="During"
98
- stroke={chart.color}
99
  strokeWidth={2}
100
  dot={{ r: 4 }}
101
  connectNulls
@@ -104,7 +105,7 @@ function Charts({ data, painData }) {
104
  type="monotone"
105
  dataKey={chart.afterKey}
106
  name="After"
107
- stroke={chart.color}
108
  strokeWidth={2}
109
  strokeDasharray="5 3"
110
  dot={{ r: 4 }}
 
4
  } from 'recharts';
5
  import './Charts.css';
6
 
7
+ const PAIN_DURING_COLOR = '#ef4444';
8
+ const PAIN_AFTER_COLOR = '#3b82f6';
9
+
10
  const PAIN_CHARTS = [
11
  {
12
  location: 'left_knee',
13
  title: 'Left Knee Pain',
 
14
  duringKey: 'left_knee_during',
15
  afterKey: 'left_knee_after',
16
  },
17
  {
18
  location: 'right_knee',
19
  title: 'Right Knee Pain',
 
20
  duringKey: 'right_knee_during',
21
  afterKey: 'right_knee_after',
22
  },
 
47
  return (
48
  <div className="charts">
49
  <div className="chart-container card">
50
+ <h2>Weekly Distance</h2>
51
  <ResponsiveContainer width="100%" height={300}>
52
  <BarChart data={chartData}>
53
  <CartesianGrid strokeDasharray="3 3" />
54
  <XAxis dataKey="label" />
55
  <YAxis>
56
+ <Label value="Km" angle={-90} position="insideLeft" style={{ textAnchor: 'middle', fill: '#6b7280' }} />
57
  </YAxis>
58
  <Tooltip />
59
  <Bar dataKey="distance" fill="var(--color-primary)" radius={[4, 4, 0, 0]} />
 
67
  <CartesianGrid strokeDasharray="3 3" />
68
  <XAxis dataKey="label" />
69
  <YAxis>
70
+ <Label value="Load" angle={-90} position="insideLeft" style={{ textAnchor: 'middle', fill: '#6b7280' }} />
71
  </YAxis>
72
  <Tooltip />
73
  <Line
 
88
  <CartesianGrid strokeDasharray="3 3" />
89
  <XAxis dataKey="label" />
90
  <YAxis domain={[0, 10]}>
91
+ <Label value="Pain" angle={-90} position="insideLeft" style={{ textAnchor: 'middle', fill: '#6b7280' }} />
92
  </YAxis>
93
  <Tooltip />
94
  <Legend />
 
96
  type="monotone"
97
  dataKey={chart.duringKey}
98
  name="During"
99
+ stroke={PAIN_DURING_COLOR}
100
  strokeWidth={2}
101
  dot={{ r: 4 }}
102
  connectNulls
 
105
  type="monotone"
106
  dataKey={chart.afterKey}
107
  name="After"
108
+ stroke={PAIN_AFTER_COLOR}
109
  strokeWidth={2}
110
  strokeDasharray="5 3"
111
  dot={{ r: 4 }}