Ordinal Scale Revamp, Origin Methods
Pre-release
Pre-release
Good afternoon,
This release features some major changes to Scale.Ordinal
, as well as methods for querying the origin of Component
s.
Features
Scale.Ordinal
revamp
Scale.Ordinal
used to have two modes for how they map their domain onto the range: "points" and "bands". Not only did this create confusion, but somePlot
s would render inconsistently if theScale
was in the wrong mode.Scale.Ordinal
now has only one mode.- The
scale()
method onScale.Ordinal
now scales to the center of the band, not the start:
innerPadding()
andouterPadding()
are now defined as proportion of the band width.innerPadding
is defined as the padding in between bands.outerPadding
is defined as the padding between the outer bands and the edge of the scale.fullBandStartAndWidth()
has been removed in favor ofstepWidth()
.stepWidth()
method returns the distance between successive values on the scale, in pixels.
Component
Origin Methods
Two methods have been added to Component
s:
origin()
gets the location of the Component's upper-left-corner relative to its parent.originToSVG()
gets the location of the Component's upper-left corner relative to the root<svg>
node.
Bugfixes
Bar
plots now account for the ends of theScale
when automatically computing bar widths.Axis
labels are now confined to theAxis
's bounding-box within the<svg>
(#1501)- End ticks are consistently visible on both ends of an
Axis.Time
(#1509) - Tick labels now show up at regular intervals (#1196)
API Breaks
innerPadding()
andscale()
methods onScale.Ordinal
now behave very differently.fullBandStartAndWidth
has been renamed and revamped intostepWidth()
Upgrade Instructions
- The
innerPadding()
method onScale.Ordinal
used to return the padding in pixels; now it returns the padding as a proportion of the band width.ordinalScale.bandWidth() * ordinalScale.innerPadding()
will calculate the padding in pixels. - Since
scale()
now returns the position corresponding to the middle of the band,ordinalScale.scale(value) - ordinalScale.rangeBand() / 2
will yield the position at the start of the band. fullBandStartAndWidth()
can be replaced by the above calculation andstepWidth()
.
Future Changes
- As we have upgraded our library to use Typescript 1.4, we are moving in the near future to actually use some of its features like union typing. Our library as of the current moment should still be compatible with Typescript 1.3, but we will not be compatible with it in the near future.