d3 / d3-shape

Graphical primitives for visualization, such as lines and areas.
https://d3js.org/d3-shape
ISC License
2.48k stars 308 forks source link

A more robust way of specifying area.x0 = area.x1? #24

Closed mbostock closed 8 years ago

mbostock commented 8 years ago

Currently we use strict equality on the specified values. This makes sense for constants, but it seems a bit surprising if the x0 and x1 accessor are specified as functions.

Perhaps we should have a more explicit way of specifying when the baseline (x0 or y0) reuses the topline (x1 or x1, respectively) value? Perhaps this is what the value null should signify?

(Related #23, especially if we auto-promote constants to functions, in which case the same value won’t result in the same function, and we’ll evaluate the function twice; although, since the function returns a constant value, this won’t do any harm.)

mbostock commented 8 years ago

Related: specifying area.x(f) where f is a nondeterministic function should set x0 = x1 (rather than computing the two independently), whereas area.x0(f).x1(f) should not.