Skip to content

Commit

Permalink
changed default chart bar label to new formt of 'X.Y h'
Browse files Browse the repository at this point in the history
  • Loading branch information
RedFoxFinn committed May 2, 2024
1 parent 91dc890 commit f4cf5d2
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions frontend/src/components/TimeLogsPage/TimeLogChart.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ const TimeLogChart = (props) => {
altLabel: `${hours} h, ${minutesLeft} min`,
hLabel: `${hours} hours`,
minutes: minutesLeft,
mLabel: `${minutesLeft} minutes`
mLabel: `${minutesLeft} minutes`,
defaultLabel: `${altHours.toFixed(1)} h`
})
}
} else {
Expand All @@ -93,7 +94,8 @@ const TimeLogChart = (props) => {
altLabel: `${hours} h, ${minutesLeft} min`,
hLabel: `${hours} hours`,
minutes: minutesLeft,
mLabel: `${minutesLeft} minutes`
mLabel: `${minutesLeft} minutes`,
defaultLabel: `${altHours.toFixed(1)} h`
})
}
}
Expand Down Expand Up @@ -124,7 +126,7 @@ const TimeLogChart = (props) => {
dataKey='altHours'
background={false}
>
<LabelList dataKey='altLabel' position='top' />
<LabelList dataKey='defaultLabel' position='top' />
{chartData.map((entry, index) => (
<Cell key={`cell-${index}`} fill={barColourSet[index % barColourSet.length]} />
))}
Expand Down Expand Up @@ -178,7 +180,7 @@ const TimeLogChart = (props) => {
dataKey='altHours'
background={false}
>
<LabelList dataKey='altLabel' position='top' />
<LabelList dataKey='defaultLabel' position='top' />
{chartData.map((entry, index) => (
<Cell key={`cell-${index}`} fill={barColourSet[index % barColourSet.length]} />
))}
Expand Down

0 comments on commit f4cf5d2

Please sign in to comment.