Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

expenses chart component main using HTML CSS and JavaScript

@stephanniegb

Desktop design screenshot for the Expenses chart component coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
2junior
View challenge

Design comparison


SolutionDesign

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?

Community feedback

P
Justin Green 2,750

@jgreen721

Posted

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

0

@stephanniegb

Posted

@jgreen721 thanks I'll definitely try it out

0

Please log in to post a comment

Log in with GitHub
Discord logo

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