I'm currently working on a data visualization project and am facing an issue with adding values to a slider. The slider itself is functioning correctly, but I can't seem to display any values below it on the webpage. My goal is to show dates like 2021-12-15 beneath the slider. How can I achieve this? Below is the code I've been working on so far. Thank you in advance!
<div class="slidecontainer">
<input type="range" min="1" max="12" value="12" class="slider" id="mySlider">
</div>
<script>
var slider = document.getElementById("mySlider");
var output = document.getElementById("demo");
output.innerHTML = slider.value; // Display the default slider value
// Update the current slider value (each time you drag the slider handle)
slider.oninput = function() {
output.innerHTML = this.value;
}
</script>
function slider_Update(binNumber) {
new_date = formatTime(new Date("2008-"+binNumber+"-01"));
let checked_group = ".";
let count = 1;
// For each checkbox:
d3.selectAll(".checkbox").each(function(d){
const cb = d3.select(this);
const grp = cb.property("value");
if(cb.property("checked")){
if(count===1){
checked_group += grp;
count++;
}else{
checked_group += ",."+grp;
}
}
})
update_Worldmap(checked_group);
update_BarPlot();
}
d3.select("#mySlider").on("change", function(d){
selectedValue = this.value
slider_Update(selectedValue)
})