Understand Data Bounds and Coordinate Space Information
webglplot-v2The webgl-plot API (v2) returns bounds objects that include coordinateSpace information. This eliminates ambiguity when determining if bounds are in linear or logarithmic space.
getDataBounds() vs getAllDataBounds():
getAllDataBounds(): Returns the complete extent of all data. Use this to auto-scale to fit everything in view.getDataBounds(): Returns the current viewport bounds. Use this to maintain the current zoom/pan state when data changes or when switching coordinate spaces.
Return Object Shape:
{
minX: number,
maxX: number,
minY: number,
maxY: number,
coordinateSpace: { x: "linear" | "log", y: "linear" | "log" }
}