v2.6.0
Features
Pan and Zoom Support for Categorical Axes
Users can now pan and zoom charts with categorical axes.
In addition to this, a pan/zoom API is added to transformable scales that allows users to imperatively pan
and zoom
.
For example, to zoom the xScale by a certain amount around a center point, simply xScale.zoom(zoomAmount, xCenter);
. To pan in a given direction yScale.pan(panAmount)
;
Expose Pan and Zoom API in PanZoom Interaction
Users may now directly control panning and zooming through the PanZoom interaction layer with the addition of the pan
and zoom
endpoints. These differ from the pan
and zoom
endpoints on transformable scales in that calling the interaction-layer endpoints will affect all scales grouped within that interaction layer. This may be useful for manually panning and zooming multiple linked charts, like small multiples.
To zoom around the center of a chart, call the PanZoom instance with the desired zoom amount. A value of 1
will have no effect, a value of 1.1
will zoom out by 10% and a value of 0.9
will zoom in by 10%. this.panZoomInteraction.zoom(zoomAmount);
.
To zoom around a different point call zoom
with the point around which you'd like to zoom. this.panZoomInteraction.zoom(zoomAmount, zoomPoint);
To pan a chart, call pan
with a point {x, y} where the x and y values represent the dx and dy of the panning action.
this.panZoomInteraction.pan({ x: center.x - oldCenter.x, y: center.y - oldCenter.y});
Add entitiesIn
to Line Plot
Line plots now implement the entitiesIn
method. As is the case with the other XYPlot types, calling entitiesIn
on a linePlot now returns all entities that intersect the specified bounds.