score:3

Accepted answer

just a couple of changes were necessary.

change to the handling of the enter/update selection:

var rectangle = svg.selectall("rect")
    .data(dataset);

rectangle
    .enter()
    .append("rect");

rectangle
    .attr("width", 20)
    ...

change to the placement of the svg element outside the slider handler.

complete fiddle.

note: the current height of the svg element is not sufficient to see the magnitude of changes allowed by the slider. you should increase that, say attr("height", 200).

another fiddle responding to the slide event and thus making the change to the rect's height more pleasing to the eye.


Related Query