Published
Edited
Jul 28, 2020
Importers
1 star
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
fontSize=30*width/954
Insert cell
f=x(50)-x(0)
Insert cell
xAxis = g => g
.attr("transform", `translate(0,${height - margin.bottom})`)
.style("font-size", fontSize)
.attr("color", "blue")
.call(d3.axisBottom(x)
.tickSize(10)
.tickValues([0, 50, 100])
.ticks(3)
.tickFormat(d3.format(",.0f"))
)
Insert cell
yAxis = g => g
.attr("transform", `translate(${margin.left},0)`)
.style("font-size", fontSize)
.attr("color", "red")
.call(d3.axisLeft(y)
.tickSize(10)
.tickValues([0, 50, 100])
.tickFormat(d3.format(",.0f"))
.ticks(3)

)
.call(g => g.select(".domain").remove())
Insert cell
path = shape2path.rect()
.attr("x", d => d.x)
.attr("y", d => d.y)
.attr("width", d => d.w)
.attr("height", d => d.h)
.attr("rx", d => d.rx)
.attr("ry", d => d.ry);
Insert cell
x = d3.scaleLinear()
.domain([0, 100])
.range([margin.left, width - margin.right])
Insert cell
y = d3.scaleLinear()
.domain([0, 100])
.range([height - margin.bottom, margin.top])
Insert cell
margin = ({top: 40, right: 100, bottom: 100, left: 120})
Insert cell
height = width
Insert cell
d3 = require("d3@5")
Insert cell
shape2path = require("shape2path@3.0.3");
Insert cell
import {input} from "@jashkenas/inputs"
Insert cell
import {slider} from "@jashkenas/inputs"
Insert cell
import {Scrubber} from "@mbostock/scrubber"
Insert cell
Insert cell
import {inputsGroup} from "@bumbeishvili/input-groups"
Insert cell
function form(form) {
const container = html`<div>${form}`;
form.addEventListener("submit", event => event.preventDefault());
form.addEventListener("change", () => container.dispatchEvent(new CustomEvent("input")));
form.addEventListener("input", () => container.value = formValue(form));
container.value = formValue(form);
return container
}
Insert cell
function formValue(form) {
const object = {};
for (const input of form.elements) {
if (input.disabled || !input.hasAttribute("name")) continue;
let value = input.value;
switch (input.type) {
case "range":
case "number": {
value = input.valueAsNumber;
break;
}
case "date": {
value = input.valueAsDate;
break;
}
case "radio": {
if (!input.checked) continue;
break;
}
case "checkbox": {
if (input.checked) value = true;
else if (input.name in object) continue;
else value = false;
break;
}
case "file": {
value = input.multiple ? input.files : input.files[0];
break;
}
case "select-multiple": {
value = Array.from(input.selectedOptions, option => option.value);
break;
}
}
object[input.name] = value;
}
return object;
}
Insert cell
import {viewof width} from '@jrus/widthview'
Insert cell
width

Insert cell
viewof valeurs= form (html `

<form>
<TABLE BORDER="1">
<TR>
<th> Impact </th>
</tr>
<tr>
<td>
<div data-tip="This is the text of the tooltip2">
<input class="form-control-range" title="This is the text of the tooltip" name= "a" type="range" value=2 min="0" max="5">
<div>
<p> fsdf<p>
<input class="form-control-range" name= "b" type="range" value=2 min="0" max="5">
<button onclick="myFunction()">Try it</button>

<div id="myDIV">
This is my DIV element.
</div>
<input class="form-control-range" name= "c" type="range" value=2 min="0" max="5">
</td>
<td>
<input class="form-control-range" name= "d" type="range" value=2 min="0" max="5">
<input class="form-control-range" name= "e" type="range" value=2 min="0" max="5">
<input class="form-control-range" name= "f" type="range" value=2 min="0" max="5">
</td>
</tr>

</form>
<script>
function myFunction() {
var x = document.getElementById("myDIV");
if (x.style.display === "none") {
x.style.display = "block";
} else {
x.style.display = "none";
}
var x = document.getElementByName("b");
x.value=3
}
</script>`)
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more