Skip to main content
100%

Customization of bush handler

✓ Published0🌍 Public
11Cr18Ni9
Last edited Feb 19, 2017
Created on Feb 17, 2017

This example shows an interactive scatterplot of 800 random data points, where a brush control selects a range along the x-axis and highlights the corresponding circles in red. The brush’s resize handles are customized with triangular SVG paths, generated by a `triangleData` function that computes relative path coordinates for the `d` attribute, using D3 v3’s `d3.svg.brush`, `d3.scale.linear`, and `d3.svg.axis`. The static SVG rendering relies on a fixed viewport with margins and translucent styling for the brush extent and selected circles.

AI-generated description

Built with blockbuilder.org

Just as all of you know that the magic come from paht's d attribute. Using function triangleData to generate a string which contain the d's value, such as:

m 0,0 -10.717967697244909,40 21.435935394489817,0 z

that is: pt1=(0,0), pt2=(-10.717967697244909,40) and pt3=(21.435935394489817,0)

then an erect triangle-path is generated.

Lowercase commond indicates that sibling points' coordinates of d-value is relative coordinate. So point pt2 is based on pt1, and pt3 is based on pt2, then on and on.

mit Licensed

Similar vizzes