How to create a simple 2 bar chart in HTML with variable data input | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to create a simple 2 bar chart in HTML with variable data input

I am working on a project and I want to show a simple 2 bar chart in HTML showing and comparing 2 kinds of data, the value of the house and the value of the mortgage. Because every situation is different, both values can vary. I just started studying JS and don´t know a lot of JS. My question is: is there a simple code which I can use?

21st Aug 2020, 1:32 PM
Bernard Kemman
Bernard Kemman - avatar
2 Answers
+ 1
In html Use two div of desired heights and width. Then Make two range slider for variation in height of bar Then make a button In js Get div height and width Get value of both range slider in variables. Add event listener on button to set height and width equal value of range. Try it .you can do it.
21st Aug 2020, 1:49 PM
Divya Mohan
Divya Mohan - avatar
+ 1
Divya Mohan thanks, I am going to try this
21st Aug 2020, 8:11 PM
Bernard Kemman
Bernard Kemman - avatar