You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I have a d3.scaleLinear object, very frequently I'll want to convert the length of some object in domain coordinates into range coordinates. For instance, if an object has a length of x in domain coordinates, then I'd compute its length in range coordinates using scale(x)-scale(0), but this introduces a needless computation of scale(0). It would be nice to have a convenience function scale.length(x), where a scale whose equation is y = a*x+b computes scale.length(x) as simply a*x. This would be useful for shapes like rect and circle that are defined by their dimensions in range coordinates (width, height, r), but which you might want to specify using their dimensions in domain coordinates.
This could probably also be extended to other continuous scales. For instance, a log scale y = m*log(x) + b would treat x as a ratio of two points in the domain and have scale.length(x) == m*log(x).
The text was updated successfully, but these errors were encountered:
When I have a
d3.scaleLinear
object, very frequently I'll want to convert the length of some object in domain coordinates into range coordinates. For instance, if an object has a length ofx
in domain coordinates, then I'd compute its length in range coordinates usingscale(x)-scale(0)
, but this introduces a needless computation ofscale(0)
. It would be nice to have a convenience functionscale.length(x)
, where a scale whose equation isy = a*x+b
computesscale.length(x)
as simplya*x
. This would be useful for shapes likerect
andcircle
that are defined by their dimensions in range coordinates (width
,height
,r
), but which you might want to specify using their dimensions in domain coordinates.This could probably also be extended to other continuous scales. For instance, a log scale
y = m*log(x) + b
would treatx
as a ratio of two points in the domain and havescale.length(x) == m*log(x)
.The text was updated successfully, but these errors were encountered: