Skip to content

InterpolatedColorLegend, getAllSelections()

Pre-release
Pre-release
Compare
Choose a tag to compare
@jtlan jtlan released this 30 Jan 22:32
· 4987 commits to master since this release

screen shot 2015-01-30 at 2 12 18 pm

Good 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:
screen shot 2015-01-30 at 2 13 07 pm

As with other Plottable Components, CSS can be used to restyle it:
screen shot 2015-01-30 at 2 30 37 pm

getAllSelections()

The getAllSelections() method has been added to Plots. 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 Datasets, or associated with specific pixel positions / ranges (similar to the existing getBars() API point on Bar plots).