Releases: palantir/plottable
LinePlot Bugfix + AnimateOnNextRender
- Fixed a bug where css properties on
LinePlots
were lost. The same properties are now projected as an attribute, so thatproject
will still work but they may be overriden. - Plots now have an
animateOnNextRender
flag that is set when the data changes, and will not animate on other renders (e.g. due to svg resizing)
Fix IE 9 category axes
Due to a change introduced in v0.19.0
, category axes would fail on IE 9. It was fixed by #637.
Category Axis Performance and Date Axis Support
Category Axis Performance
@bmalehorn implemented caching in CategoryAxis
text measurement, which significantly improved performance
Since cat-caching has been so important, the cash-cat is this release's mascot.
Time Formatters
@lewin added Time formatters, so that Numeric Axes can better render dates and times. The formatter will automatically determine which level of granularity to specify the data (whether it is in years, months, days, etc.). A better timescale (#617) is in works to deal with the problem of better tick generation, so this formatter is only a temporary solution to time data.
To use the time formatters, just pass in a new Plottable.Formatter.Time()
into the Numeric Axis constructor, and project an appropriate parser to parse the date data. A very simple example can be seen in quicktests/date-test.html
SI Formatters
Since you now have so much cash, there is now a convenient way to display it on an Axis
. Tired of seeing "I got 10000000000 dollas"? @jtlan's new SISuffixFormatter
would help you format it to "I got 10G dollas". Notes Justin: "This is actually not very good for displaying currency." But it is good for... ScIence!
Bugfixes
A number of other minor bugs were fixed, for example:
AreaPlots
now add a padding exception if they have a constant baseline. (#602)Scales
now appropriately update their domain when a plot is removed. (#603)Axes
now render properly when there is no associatedPlot
(#614)- Removed components will no longer throw a
Cannot measure text in a removed node
error (#624) - Fix a label layout bug (#590)
Release Music
Fix the .d.ts file
This patch fixes the plottable.d.ts
file, and introduces tests so it doesn't break again.
Also:
- You can now project
width
onto aPlot.Bar
that is backed by aScale.Ordinal
with rangeBand turned on DragBox
es no longer error out ifclearBox
orsetBox
is called before the box is anchored.
Forgiving Table Layout
Table no longer throws an Error if a component requests too much space. It warns to console instead. It also gives 0.001 pixel leeway before warning.
Domainers, Formatters, and Numeric Axis
Good afternoon,
This release introduces the following:
- Domainers: Objects that give more control over the autodomaining logic on scales.
- Formatters: Objects for formatting numbers for display.
- Numeric Axis: An axis type optimized for displaying numerical data.
In addition, Animator
s (introduced in v0.17.0
) have been added to all Plots.
Domainers
This release introduces the Domainer
object.
var xScale = new Plottable.Scale.Linear()
.setDomainer(new Plottable.Domainer().pad().nice());
This lets you turn on and off common settings for autodomaining, and gives us a place to put more of these options (include 0, etc.).
Also, you can set your own function if you want. Here's the default one:
new Plottable.Domainer((extents: any[][]) => [d3.min(extents, (e) => e[0]), d3.max(extents, (e) => e[1])])
For more info, see domainer.ts.
Formatters
Formatters have been added. These are objects that, given an value, produce a String version of the value suitable for display on an Axis. Currently there are 6 kinds:
Fixed
: Displays the number with exactly precision decimal placesPercentage
: Displays the number as a percentage with exactly precision decimal placesCurrency
: Displays the number with a given currency symbol and exactly precision decimal places.General
: Displays the number with at most precision decimal places.Identity
:String()
-ifies the input directly.Custom
: Uses a custom formatting function.
More formatters will be coming soon, such as one for displaying large numbers (ex: 50000000 --> "50M").
Formatters can be used with the new Numeric
Axis: see below.
Numeric Axis
We are currently in the process of replacing the XAxis
and YAxis
classes with Axis classes specialized for specific functionality. This process began back in v0.14.0
, when Category
axes were introduced. Numeric
Axis is optimized for the display of numbers. Unlike XAxis
or YAxis
, Numeric
axes can be used in all four orientations (top/bottom/left/right). In addition, the width of a vertical Numeric
axis or the height of a horizontal Numeric
axis is automatically set during layout; the automatic value can be overridden using the width()
and height()
calls.
As both Numeric
and Category
axes now exist, expect XAxis
and YAxis
to be removed in the next version.
API Breaks
scale.padDomain()
andscale.nice()
no longer exist. To get the same effects, usescale.domainer(new Plottable.Domainer().pad().nice())
.
Coming up
Expect XAxis
and YAxis
to be removed in the next version.
Release Music
Animating, Resizing, Rendering
Animators
This release introduces a new method for customizing and overriding animations for plots.
Options on the Plottable.Animator
namespace are:
Null
: sets attributes on the selection immediatelyDefault
: sets attributes using a transition that has configurable easing, duration, and delay.IterativeDelay
: sets attributes for each item in the selection, delaying the item by its index.
Animators are stored on the plot and are associated by a string key. For example, the VerticalBar
plot has a "baseline" animator and a "bars" animator. You can override the entire animation for bars with a call like so: plot.animator("bars", new MyAnimatorImplementation())
.
Animator capability is currently only available for VerticalBar
plots.
Auto-Resizing
This release introduces a new method on Plottable.Component
that will automatically enqueue an layout and render when the window is resized. To enable auto-resize, call component.autoResize(true)
Render Policies
The RenderController
now defers to a RenderPolicy
object for when to render components that have been queued for layout or rendering. Options on the Plottable.Core.RenderController.RenderPolicy
namespace are:
Immediate
: Renders immediately on the current stack.AnimationFrame
: Renders on the next available animation frame (if requestAnimationFrame is not available, it falls back to setTimeout).Timeout
: Renders using setTimeout
API Breaks
- The
Plottable.Singleton
namespace was renamed toPlottable.Core
- The
.project()
method on plots will only pass the result of the accessor through a scale if and only if it is supplied as the 3rd argument. This is contrary to previous behavior where projectors on "x" and "y" would always pass the result through the x-scale and y-scale, respectively.
Release Song
Interactive Legends
http://palantir.github.io/plottable/examples/release/interactiveLegend.html
This release introduces some new functionality to legends to enable them to listen to both click and hover events.
Toggle events :
If click interactions are enabled, the legend will apply the class "toggled-on" or "toggled-off" to each individual legend row. Initially, everything will be toggled on. Clicking on a row will toggle its state.
Hover events :
If hover interactions are enabled, the legend will apply the class "hover" to every legend row, and the class "focus" to the row that is being hovered over.
These classes allow you to style the rows however you would like. The default styling hides
toggled-off" entries, and lowers the opacities of entries with only the "hover" class.
To turn these on, call .toggleCallback(function(datum, newState))
and .hoverCallback(function(datum))
on the legend. The argument is a callback that will be called when a legend row is clicked or moused over. For an example of how to do this, see examples/release/interactiveLegend.html
This release also fixes a bug #537 so category axis now returns sensible values for requestedSpace if the domain is empty.
Release Song
Fix phantomjs flakiness
Because PhantomJS doesn't set up the DOM in the same way as the browser, it was causing isSelectionRemoved
to fail in testing. I changed the semantics to isSelectionRemovedFromSVG
which should also catch errors, but will work independently of how the top level document is set up.
Add bower.json to the bower.json manifest
Include Derek's change to the bower.json file.
Also, include the YDragBoxInteraction that Nick White added.