Improved Layout, Improved Text, and Unified Bar Plot
Pre-releaseFeatures
Unified Plot.Bar
Plot.HorizontalBarandPlot.VerticalBarhave been merged into a single classPlot.Bar. In order to choose between the two, an additional parameter has been added to thePlot.Barconstructor specifying if thePlot.Barshould be vertical (default true):
/**
* Constructs a Bar plot.
*
* @constructor
* @param {Scale} xScale The x scale to use.
* @param {Scale} yScale The y scale to use.
* @param {boolean} isVertical if the plot if vertical.
*/
constructor(xScale: Scale.AbstractScale<X, number>,
yScale: Scale.AbstractScale<Y, number>,
isVertical = true) {The classes Plot.HorizontalBar and Plot.VerticalBar have been deprecated.
Bugfixes
svg-typewriter
Writing text in SVG has always been tricky. The svg text spec indicates that "SVG performs no automatic line breaking or word wrapping", meaning that developers have to implement this functionality themselves; In addition, it is difficult to accurately measure the size of text without writing it.
We have switched to using svg-typewriter to resolve these problems. Consequently, a number of issues related to text have been fixed.
SVG Typewriter was developed by @endrjuskr. The library is inlined within Plottable as part of our build process, so there are no changes required to develop using Plottable.
Improved Layout Engine
@endrjuskr has updated our layout engine, which powers the Table Component. In conjunction with the switch to svg-typewriter, this change solves some strange behavior on Axis.Category, as well as other bugs such as #936
API Breaks
Aside from the now-deprecated Plot.HorizontalBar, the barAlignment() method on Bar Plots now only accepts "left", "center", and "right" as alignment choices, regardless of if the Plot is vertical or horizontal.
Typescript API Breaks
Plot.AbstractBar has been renamed to Plot.Bar. References to Plot.AbstractBar should be changed to references to Plot.Bar.
Upgrade Instructions
You will need to change references to Plot.VerticalBar and Plot.HorizontalBar as follows:
new Plot.VerticalBar(xScale, yScale) → new Plot.Bar(xScale, yScale, true)
new Plot.HorizontalBar(xScale, yScale) → new Plot.Bar(xScale, yScale, false)In addition, invocations of barAlignment() on Plot.HorizontalBar also should be updated:
horizontalBarPlot.barAlignment("top") → barPlot.barAlignment("left")
horizontalBarPlot.barAlignment("bottom") → barPlot.barAlignment("right")Release Song
Time to Say Goodbye (to layout bugs).