Skip to content

Commit

Permalink
change labels to weekdays
Browse files Browse the repository at this point in the history
  • Loading branch information
brayo-pip committed Mar 22, 2024
1 parent 544bc40 commit 17a03ff
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/components/StackedBarChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,18 @@ const uniqueDatesSorted = uniqueDates.sort((a, b) => {
const dateB = new Date(b)
return dateA.getTime() - dateB.getTime()
})
const uniqueWeekDays = uniqueDatesSorted.map((date) => {
const dateObj = new Date(date)
return dateObj.toLocaleDateString('en-US', { weekday: 'short' })
})
const uniqueCategoriesSet: Set<string> = new Set()
summaries.value?.forEach((summary) => {
for (const category in summary?.category_totals) {
uniqueCategoriesSet.add(category)
}
})
const uniqueCategories = Array.from(uniqueCategoriesSet)
chartData.value.labels = uniqueDatesSorted
chartData.value.labels = uniqueWeekDays
const categoryValues: { [key: string]: number[] } = {}
uniqueCategories.forEach((category) => {
Expand Down

0 comments on commit 17a03ff

Please sign in to comment.