Skip to content

Hover Interactivity for Stacked Area, API Changes for Consistency

Pre-release
Pre-release
Compare
Choose a tag to compare
@jtlan jtlan released this 06 Dec 00:59
· 5419 commits to master since this release

Good afternoon,

Today's release adds hover interactivity to stacked area plots, and features some updates to improve the consistency of our API. Read on for more details.

Features

Interaction.Hover now works with Plot.StackedArea. Note that, as for Plot.StackedBar, the original data value will be returned, not the stacked value.

Whenever a domain value is scaled with Plottable.Scale.Color and the domain's length is greater than the range length, the returned scale value will be lightened in accordance to how many times the range has looped around to reach the scaled value.

API Breaking Changes

Removal of default accessors

Previously, most Plots were packaged with default accessors that looked for "x" and "y" attributes on the data. Essentially, the following lines were run when a Plot was constructed:

this.project("x", "x", xScale); // default accessor
this.project("y", "y", yScale); // default accessor

While sometimes convenient, the default accessors would sometimes return undefined or invalid data. Their presence made it difficult for the Plottable code to reason about when the user had completed setting up a Plot and it was safe to autodomain the scales or calculate the stacking offsets. Rather than try to reason about if a given projector was valid (a tricky problem if, for instance, the user meant to plot null or undefined values), we now operate under the assumption that if the user calls project(), the supplied accessor is valid.

Similarly, the default value accessor has been removed from Plot.Pie.

deselectAll() removed

The deselectAll() method has been removed from Bar plots. deselectAll() removed the "selected" CSS class from all bars in a bar Plot; With the removal of selectBar() in v0.37.0, deselectAll() no longer made sense.

Typescript API-Breaking Changes

Plot.StackedArea now extends from Plot.Area instead of Plot.AbstractStacked.

Other notes

Plottable has a number of protected/private internal variables and methods. We have now prefixed these fields with an underscore to indicate to the user that they should not be using them. Be warned that using/accessing these fields may result in behavior that you may not expect, as changes to these fields may break your code silently. Please use such variables/methods with extreme caution.

Upgrade Instructions

  • If you were previously relying on the default accessor behavior, as described above, add the following two lines after an XY-Plot is created:
xyPlot.project("x", "x", xScale);
xyPlot.project("y", "y", yScale);
  • Similarly, if you were relying on the default accessor behavior for Plot.Pie, add the following line after creating the Plot.Pie:
piePlot.project("value", "value");
  • If you were using deselectAll(), please replace it with the following line:
barPlot.getAllBars().classed("selected", false);

Future Changes

  • We are planning to lighten up the Plot constructors by having them no longer take Scales as arguments. The xScale and yScale arguments to the Plot are essentially redundant since the scales will be applied during the relevant project() calls, meaning that the constructor arguments are not particularly useful.
  • @endrjuskr has been working on a library for manipulating SVG text. We are looking to start using this library in Plottable, which should improve the behavior of text in Axis, Legend, and other places within Plottable.

Release Song

Katamari on the Rocks