Releases: palantir/plottable
Fix requestAnimationFrame bug
Fixes a regression, caught by Cassie, in which automatic layout recomputation was broken when requestAnimationFrame was enabled.
Animations
Good evening,
Charts now animate when their data changes, or when rendering for the first time. Animations can be enabled by calling .animate(true)
on Circle, Line, Area, or (Horizontal)Bar Renderers. For an example, please see quicktests/animations-quicktest.html
.
In addition, OrdinalScale now defaults to "bands" mode.
Fix the plottable.d.ts file.
v0.12.4 Move utils to src/utils
Fix bug with ComponentGroup.removeAll()
Just a patch to fix a bug in ComponentGroup.removeAll().
Fix version number for real.
v0.12.2 Release version 0.12.2
Update version number ;)
Merge pull request #419 from palantir/invalidate-layout Invalidate layout - Components now re-layout when something sizing changes
Rearchitected Layout Engine
v0.12.0 - Rearchitected Layout Engine
The Old Approach
The original Plottable layout engine computed the width and height for Component independently. Components would report how much space they wanted independent of what was available, and fail out if they were not given enough space.
This was very convenient for the initial implementation, but meant we couldn't intelligently handle cases where the width of an object might depend on its height and vice versa; principle examples being Labels and Category Axes.
Furthermore, for simplicity we assumed that the layout (eg size or position) of a Component would never change. This meant that if you changed the domain of a colorScale hooked into a Legend, or changed the text on a Label, the layout of the Table would not update appropriately.
The New Layout Engine
As of this release, when Components are being laid out the parent calls Component._requestedSpace(offeredWidth, offeredHeight)
. Now, components with cross-dimension dependencies like Labels can report how much of the width and space they will use, and may signal if they would like more space if possible. As such, we've removed two calls from the base Component class: minimumWidth(newVal?: number)
and minimumHeight(newVal?: number)
, thus reducing the size of the public API.
Also, components are now expected to be able to accept any amount of width or space, and degrade gracefully rather than throwing an error. This should improve the reliability and stability of Plottable charts.
This enables some more intelligent behavior by existing components. For example, it used to be that the user was responsible for figuring out an appropriate Legend size by setting Legend.minimumWidth(x) through trial and error. Now, the legend will compute an appropriate width on its own. Looking into the future, this lays the groundwork for us to write a more intelligent Category Axis that uses space and word-wrapping more efficiently.
Furthermore, Components now have an _invalidateLayout()
call which will schedule the entire Component tree to be re-laid out. This is hooked into the requestAnimationFrame cycle so that multiple layout-invalidating changes will be batched together for perf efficiency. All component calls that should cause the layout to change now automatically call _invalidateLayout, so if you change the text on a label or the alignment on a Table, it will automatically re-size, re-locate, and re-render.
API Breaking Changes
Component.minimumWidth
and Component.minimumHeight
have been removed from the API. If you were using these in your code, that code is now broken. In most cases, you can remove it and not think about it. For the case of axes, they now have equivalent methods xAxis.height(x)
, yAxis.width(x)
which allow you to manually set the dimensions and thus effect the old functionality.
This was an obscure part of the API so I don't think this will cause much inconvenience for downstream consumers.
We have also renamed ComponentGroup.empty() to ComponentGroup.removeAll(). ComponentGroup.empty() now is a boolean check which returns true iff the ComponentGroup is empty. This is more intuitive and consistent with the d3 API.
Axis tick label wrapping, reusable Components
Good Evening,
This version brings some new functionality:
- Axis tick label wrapping: Before, long overlapping text labels on category axes would be hidden. Now, they are wrapped to additional lines if there is room. The width of a Y-axis and the height of the X-axis can be set by the user to create more room.
The current algorithm is described in detail in #368. Improved tick wrapping algorithms, as well as the ability to insert custom algorithms, will probably be coming in the future. - Reusable Components: Previously, calling
remove()
on a Component would effectively destroy it. Now, aremove()
ed Component is removed from the DOM, but not disconnected from the Broadcasters it is listening to, allowing it to be re-added to the DOM later. Additionally, Components can be removed from ComponentGroups using theremoveComponent()
call. As Components can now be reused, it is possible to implement functionality such as showing/hiding renderers byremove()
ing them and adding them back in, or to change the placement of a Plottable chart on the page by rendering it to a different SVG. For a demonstration of the new functionality, please see addRemoveRenderers-quicktest.html in thequicktests
directory.
Improved DragBox API
API for DragBoxInteraction now includes setBox(x0, x1, y0, y1)
(for XYDragBoxInteraction
) and setBox(x0, x1)
(for XDragBoxInteraction
) which allows programmatic control of where the selection box is.
Also, when the box is cleared by the user clicking, the callback is called with a null
argument.
Add LogScale
v0.10.1 Update plottable.js, plottable.d.ts, and other build artefacts