Skip to content

c3 2.0.2

Latest

Choose a tag to compare

@danieledler danieledler released this 23 Oct 16:08
6fe9441

c3 2.0.2 makes hierarchy() give the same colors in JavaScript and Python, and throws clear errors on flows that aren't finite (#12).

Hierarchy colors

  • Same child colors in both packages. Children are placed by farthest point sampling, where many candidates are exactly as far apart. Rounding in Math.hypot and math.hypot used to decide those ties, so modules with many children got different colors in JavaScript and Python. Ties now break the same way in both.
  • Some colors change. The old tie-breaking was arbitrary, so in both packages, hierarchies with many children per module get some new child colors, and so do the subtrees below them. Hierarchies with at most about 20 children per module rarely change.

Errors

  • hierarchy() throws Flow must be finite, got Infinity for module [1] for a flow that is Infinity, -Infinity or NaN, instead of Invalid color: #NaNNaNNaN in JavaScript and black in Python.
  • hierarchy() throws Invalid path: [1, NaN] for NaN in a path.
  • palette() with weights throws Weights must be finite for a weight that isn't finite, instead of returning #NaNNaNNaN.
  • A NaN flow or weight used to count as zero, and now throws.

In JavaScript these are RangeErrors, in Python ValueErrors.