expenses chart component main using HTML CSS and JavaScript

Solution retrospective
This is definitely not the best I can do so every feedback will be be appreciated! how do i make the chart look exactly like the template while still making it dynamic?
Please log in to post a comment
Log in with GitHubCommunity feedback
- P@jgreen721
I think rather than using the chart.js library, you can just map thru the data and create a new div element to act as your bar and create its height based upon the amount value and then just append that onto the page.
So something like
data.forEach((day) => { var chartDiv = document.createElement("div"); chartDiv.className = "chart-div"; chartDiv.style.height = day.amount * 2 + "px"; document.querySelector(".yourchart").append(chartDiv); })
Again, just an example...that appears to print out really awkward, grrr, lol but text editor should be able to clean it up.
Nice work though. It all looks good and there certainly no harm in getting some practice in with the chart lib!
Marked as helpful
Join our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord