[v1.2.0] PanZoom Interaction Improvements
As we mentioned in the previous release, the Plottable team is continuing to focus on making significant performance improvements, as well as developing new features. This week's release includes some improvements to Interactions.PanZoom
.
Performance Improvements
58x speedup: Improved Responsiveness by Deferred Rendering
A deferred rendering option has been added to all Plot
s except Plots.Pie
. When enabled with plot.deferredRendering(true)
, the Plot
will respond to X and Y Scale
updates more quickly, improving the performance of Interactions.PanZoom
, particularly at larger data scales.
This speedup is accomplished by applying an SVG transformation in response to X and Y Scale
updates, then re-rendering the Plot
when no updates have been received for 500ms. Due to the transformation, parts of the Plot
may appear distorted when zooming until the Plot
re-renders.
deferredRendering()
defaults to false
.
8000 points on Plots.Scatter
:
- Try toggling
deferredRendering()
on and off: http://jsfiddle.net/e4wg58ec/
Features
Zoom Limits on Interactions.PanZoom
It is now possible to set minimum and maximum limits on zooming on Interactions.PanZoom
.
This feature works by setting minimum and maximum "extent" (the total size of the domain) for a given QuantitativeScale
attached to the Interactions.PanZoom
. When a minimum (or maximum) limit is reached on any Scale
attached to the Interaction
, the user will not be able to zoom in (or out) any further.
IMPORTANT: this feature only works with Scales.Linear
and Scales.Time
.
To get/set a minimum extent:
minDomainExtent<D>(qScale: QuantitativeScale): D;
minDomainExtent<D>(qScale: QuantitativeScale, minDomainExtent: D): Interactions.PanZoom;
To get/set a maximum extent:
maxDomainExtent<D>(qScale: QuantitativeScale): D;
maxDomainExtent<D>(qScale: QuantitativeScale, minDomainExtent: D): Interactions.PanZoom;
Try it out: http://jsfiddle.net/yu4aw4pe/