๐:1
This is where the problem sits:
updateChart(0, value);
this is responsible for updating data in data array position 0. When you change it to updateChart(1, value);
it will update People
category data. Change your code so the parameter is set dynamically based on the clicked slider.
โ== UPDATE BELOW ==โ
Looking up the code I found identifier for rangeSlider. Which suits perfectly for your case.
I do not know if this is correct way of passing this information, but it seems to be working.
Use updateChart(this.identifier.slice(-1), value);
Quick explanation โ each object has got identifier such as
identifier : "js-rangeslider-0"
so I am taking current object (this
), going inside .identifier
and taking last character of this string .slice(-1)
.