Skip to content

Instantly share code, notes, and snippets.

@veltman
veltman / README.md
Last active January 16, 2020 10:50
Automatic label placement along path

A method for automatically finding the best eligible label position and size for a label that's going to go along a path inside of an area. This is potentially suitable for area charts where the area being labeled has a clear direction the text should "flow" in.

The basic approach is a crude one: test a center point at a certain font size, and work outwards to the left and right and disqualify it if you ever hit the side of the chart or run out of vertical space. If it fits, try a bigger size. If not, try a smaller size. Rinse/repeat until you've either found the largest size that will fit at that position or found that nothing will fit. Repeat with each possible center point until you've found the largest font size you can use, and where to put it.

Notes:

  • This adds a small optimization of disqualifying any candidate points that involve a sharp angle turn, because text turning at a sharp angle can be pretty hard to read.
  • Another optimization that's omitted for brevity is to first try to use a flat label
@alexmacy
alexmacy / .block
Last active September 24, 2019 12:24
Audio Spectrum Analyzer - bright
license: mit
@mikeskaug
mikeskaug / README.md
Last active June 29, 2022 14:13 — forked from vasturiano/README.md
Brownian motion

Simulation of particles immersed in fluid at some temperature, using the d3-force physics engine.

This is was inspired by this block.

The velocities of the fluid particles are drawn from the Maxwell-Boltzman velocity distribution and scale with temperature like sqrt(T).

This illustrates the origin of Brownian motion, which is the random motion of particles suspended in a fluid due to collisions with the fast moving fluid particles or molecules.

@jimmywarting
jimmywarting / readme.md
Last active March 11, 2024 17:42
Cors proxies
Exposed headers
Service SSL status Response Type Allowed methods Allowed headers
@sjengle
sjengle / .block
Last active January 16, 2024 13:51 — forked from mbostock/.block
Flight Paths Edge Bundling
license: gpl-3.0
height: 500
border: no
@veltman
veltman / .block
Last active October 26, 2018 17:20
Scribble map
height: 600
@alexmacy
alexmacy / .block
Last active June 25, 2017 21:39
Force-Directed Voronoi Graph
license: gpl-3.0
height: 600
@AntonLecock
AntonLecock / .block
Last active March 10, 2017 08:47
Pluto isn't that special, after all
license: mit
border:
height: NaN
@Fil
Fil / .block
Last active May 25, 2017 07:10
Example of d3-ForceEdgeBundling on US airline routes graph.
license: mit
@Fil
Fil / .block
Last active September 9, 2017 02:09
K-Means as a force
license: gpl-3.0
height: 960