[v1.13.0] Off-Bar-Labels and Legend Formatters
We're very excited to release off-bar labels this week! Now, if labels do not fit inside a bar, they will be placed just outside of the bar. Additionally, we are releasing legend formatters, which gives developers the ability to alter the text of legend entries.
In this release we've also fixed two bugs on Scales
, and added a clipPath to SelectionBoxLayer
s.
Features
Better label display on Plots.Bar
When labels are enabled, Plots.Bar
will now show labels off the bar if the label would not fit on the bar. The off-bar labels can be styled using the CSS class off-bar-label
. On-bar labels carry the CSS class on-bar-label
.
This feature also works on Plots.ClusteredBar
, but has not yet been implemented on Plots.StackedBar
(#2795).
Special thanks to @okal for work on this feature.
Try it out: http://jsfiddle.net/9qq0zw9u/
Typescript 1.6
Plottable is now being developed using Typescript 1.6. Check out their release notes for more details on the new features.
Please note that Plottable currently only takes advantages of features in releases up to Typescript 1.5. This is to maintain a smoother upgrade path for our users. To use the latest typescript features, please pull the latest release of Plottable and run npm install
.
Formatter
for Legend
Previously, Legend
entries displayed the domain values of the Legend
's Scales.Color
. Now Legend
s have the endpoint .formatter()
, which can be used to format the displayed text. If the legend uses a comparator
function, it will be applied after the entries have been formatted.
/**
* Gets the Formatter for the text.
*/
formatter(): Formatter;
/**
* Sets the Formatter for the text.
*
* @param {Formatter} formatter
* @returns {Legend} The calling Legend.
*/
formatter(formatter: Formatter): Legend;
Try it out: http://jsfiddle.net/cmf3ut7g/13/
Bug Fixes
- Plottable had a bug where autodomain did not work when
Scales
were attached after rendering.Scales
now autodomain correctly. (#2396). clipPath
s are now enabled onSelectionBoxLayer
. Previously,SelectionBoxLayers
could be drawn outside of their table cell or svg. (#2769). Thanks to @jacqt for this fix!Scales.Time
now have a larger default domain, and will render with meaningful labels by default. (#2740).