This is a solution to the Expenses Chart Component. Frontend Mentor challenges help you improve your coding skills by building realistic projects.
Users should be able to:
- View the bar chart and hover over the individual bars to see the correct amounts for each day
- See the current day's bar highlighted in a different colour to the other bars
- View the optimal layout for the content depending on their device's screen size
- See hover states for all interactive elements on the page
- Bonus: See dynamically generated bars based on the data provided in the local JSON file
- Semantic HTML5 markup
- CSS custom properties
- Flexbox
- Mobile-first workflow
- BEM Methodology
- CSS Transitions
Coding the bar chart from scratch was very fun. My code was pretty rudimentary and lacked flexibility, but it is responsive and I personally feel the styling was very modular.
I converted the .json file into a .js file because the solutions I found online to locally importing a .json file felt very hacky.
- Calc allowed me to properly center the tooltips in the bar. https://developer.mozilla.org/en-US/docs/Web/CSS/calc
- Used a rule of three formula to get the correct PX height for the bar. https://byjus.com/maths/direct-proportion/
- Twitter - @codingtomato