From 122a77fcfad317459a05c79780123b1d3c55a05d Mon Sep 17 00:00:00 2001 From: Jonathan Berrisch Date: Sun, 18 May 2025 22:24:03 +0200 Subject: [PATCH] Update tailweight input --- app.qmd | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app.qmd b/app.qmd index cda104f..ee2f899 100644 --- a/app.qmd +++ b/app.qmd @@ -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;