Skip to content

Commit

Permalink
Merge pull request #304 from Ohtuilmo/change/chart_label_formatting
Browse files Browse the repository at this point in the history
changed default chart bar label to new formt of 'X.Y h'
  • Loading branch information
miahro authored May 2, 2024
2 parents 0df1121 + f4cf5d2 commit 5152019
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 @@ -126,7 +128,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 @@ -180,7 +182,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 5152019

Please sign in to comment.