Skip to content

[v1.13.0] Off-Bar-Labels and Legend Formatters

Compare
Choose a tag to compare
@crmorford crmorford released this 25 Sep 20:35
· 896 commits to develop since this release

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 SelectionBoxLayers.

Features

Better label display on Plots.Bar

screen shot 2015-09-24 at 11 51 24 am

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

screen shot 2015-09-25 at 12 31 39 pm

Previously, Legend entries displayed the domain values of the Legend's Scales.Color. Now Legends 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).
  • clipPaths are now enabled on SelectionBoxLayer. 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).