InterpolatedColorLegend, getAllSelections()
Pre-releaseGood afternoon,
Today's release adds a legend for InterpolatedColor
scales, as well as an API point for retrieving the DOM nodes forming a Plot
's visualization.
Features
InterpolatedColorLegend
InterpolatedColorLegend
has been added. This Component
visualizes a Scale.InterpolatedColor
, providing some context as to what the colors represent. The constructor:
constructor(interpolatedColorScale: Scale.InterpolatedColor, orientation?: string, formatter?: Formatter);
The InterpolatedColorLegend
supports three orientations: "horizontal" (default, shown above), "left", and "right":
`"left"` | `"right"` |
It also accepts a Formatter
(the same kind passed to an Axis
), which can be used to format the labels:
As with other Plottable Component
s, CSS can be used to restyle it:
getAllSelections()
The getAllSelections()
method has been added to Plot
s. This method retrieves the DOM nodes associated with a Plot
's visualization as a D3.Selection
: on a Plot.Line
, it will retrieve the <path>
elements, on a Plot.Scatter
it will retrieve the <circle>
s, etc. This API point should open up more possibilities for dynamic styling and interactivity.
Bugfixes
Plot.Pie
now displays warnings in the console when if populated with negative data values (1505). As before, console warnings can be suppressed by setting Plottable.Config.SHOW_WARNINGS
to false
.
API-Breaking Changes
barPlot.getAllBars()
has been removed in favor of getAllSelections()
.
Other notes
The color of text in Legend
and InterpolatedColorLegend
has been changed to match that used on Axis
. See plottable.css for details.
Upgrade Instructions
If you were using barPlot.getAllBars()
, please replace that call with barPlot.getAllSelections()
.
Future Changes
To go with getAllSelections()
, we plan to implement methods for retrieving selections associated with specific Dataset
s, or associated with specific pixel positions / ranges (similar to the existing getBars()
API point on Bar
plots).