tutograph3 = {
const svg = d3.create('svg')
.attr('viewBox', [0, 0, width, height]);
const wrapper = svg.append('g')
.attr('transform', `translate(${margin.left}, ${margin.top})`);
wrapper.append('g')
.call(xAxis);
const text = svg.append("text")
.text("Vitesse:")
.attr("x", 80 )
.attr("y", 50)
.attr("font-size", 15)
function do_something(d){
let circle = d3.select(this)
let is_unselected = circle.attr("stroke-width") == 0.4
circle.attr("stroke-width", is_unselected ? 4 : 0.4)
let vitesse = circle.attr('v')
const message = "Vitesse : " + vitesse
text.text(message)
};
d3.timeout(() => {
const circles = wrapper.selectAll('circle')
.data(running)
.join('circle')
.attr('v', d => d.vitesse)
.attr('r', d => d.distance)
.attr('fill', '#FFED4A')
.attr('stroke', 'black')
.attr('stroke-width', '0.4')
.style("cursor", "pointer");
for (var i = 0, n = Math.ceil(Math.log(force.alphaMin()) /
Math.log(1 - force.alphaDecay())); i < n; ++i) {
force.tick();
circles
.attr('cx', d => d.x)
.attr('cy', d => d.y)
.on('click', do_something)
}});
return Object.assign(svg.node(), {force});
}