Update tailweight input

This commit is contained in:
2025-05-18 22:24:03 +02:00
parent d8f476013a
commit 122a77fcfa

View File

@@ -65,8 +65,11 @@ chart = {
// tail weight control
const tailwControl = controlsContainer.append("div").style("display","flex").style("align-items","center").style("gap","10px");
tailwControl.append("label").text("Tail weight:").style("font-size","16px");
tailwControl.append("select").selectAll("option").data([0.25,0.5,1,2,4]).enter().append("option").attr("value", d => d).property("selected", d => d === selectedTailw).text(d => d);
tailwControl.select("select").on("change", function() { selectedTailw = +this.value; updateChart(filteredData()); });
tailwControl.append("input")
.attr("type","range").attr("min", -2).attr("max", 2).attr("step", 1)
.property("value", Math.log2(selectedTailw))
.on("input", function() { selectedTailw = 2 ** (+this.value); tailwControl.select("span").text(selectedTailw); updateChart(filteredData()); });
tailwControl.append("span").text(selectedTailw).style("font-size","16px");
// Build SVG
const width = 800;
const height = 400;