ViewPortHandler class
Constructors
ViewPortHandler ()
Constructor - don't forget calling setChartDimens(...)
Methods
canZoomInMoreX ()
→ bool
Returns true if the chart is not yet fully zoomed in on the x-axis
canZoomInMoreY ()
→ bool
Returns true if the chart is not yet fully zoomed in on the y-axis
canZoomOutMoreX ()
→ bool
Returns true if the chart is not yet fully zoomed out on the x-axis
canZoomOutMoreY ()
→ bool
Returns true if the chart is not yet fully zoomed out on the y-axis
centerViewPort (List <double > transformedPts )
→ void
Centers the viewport around the specified position (x-index and y-value)
in the chart. Centering the viewport outside the bounds of the chart is
not possible. Makes most sense in combination with the
setScaleMinima(...) method.
chartHeight ()
→ double
chartWidth ()
→ double
contentBottom ()
→ double
contentHeight ()
→ double
contentLeft ()
→ double
contentRight ()
→ double
contentTop ()
→ double
contentWidth ()
→ double
fitScreen1 ()
→ Matrix4
Resets all zooming and dragging and makes the chart fit exactly it's
bounds.
fitScreen2 (Matrix4 outputMatrix )
→ void
Resets all zooming and dragging and makes the chart fit exactly it's
bounds. Output Matrix is available for those who wish to cache the object.
getChartHeight ()
→ double
getChartWidth ()
→ double
getContentCenter ()
→ MPPointF
getContentRect ()
→ Rect
getMatrixTouch ()
→ Matrix4
Returns the charts-touch matrix used for translation and scale on touch.
getMaxScaleX ()
→ double
getMaxScaleY ()
→ double
getMinScaleX ()
→ double
getMinScaleY ()
→ double
getScaleX ()
→ double
returns the current x-scale factor
getScaleY ()
→ double
returns the current y-scale factor
getSmallestContentExtension ()
→ double
Returns the smallest extension of the content rect (width or height).
getTransX ()
→ double
Returns the translation (drag / pan) distance on the x-axis
getTransY ()
→ double
Returns the translation (drag / pan) distance on the y-axis
hasChartDimens ()
→ bool
hasNoDragOffset ()
→ bool
Returns true if both drag offsets (x and y) are zero or smaller.
isFullyZoomedOut ()
→ bool
if the chart is fully zoomed out, return true
isFullyZoomedOutX ()
→ bool
Returns true if the chart is fully zoomed out on it's x-axis
(horizontal).
isFullyZoomedOutY ()
→ bool
Returns true if the chart is fully zoomed out on it's y-axis (vertical).
isInBounds (double ? x , double ? y )
→ bool
isInBoundsBottom (double ? y )
→ bool
isInBoundsLeft (double ? x )
→ bool
isInBoundsRight (double ? x )
→ bool
isInBoundsTop (double ? y )
→ bool
isInBoundsX (double ? x )
→ bool
BELOW METHODS FOR BOUNDS CHECK
isInBoundsY (double ? y )
→ bool
limitTransAndScale (Matrix4 matrix , Rect content )
→ void
limits the maximum scale and X translation of the given matrix
noSuchMethod (Invocation invocation )
→ dynamic
Invoked when a nonexistent method or property is accessed.
inherited
offsetBottom ()
→ double
offsetLeft ()
→ double
offsetRight ()
→ double
offsetTop ()
→ double
refresh (Matrix4 newMatrix )
→ Matrix4
call this method to refresh the graph with a given matrix
resetZoom (Matrix4 outputMatrix )
→ void
Zooms out to original size.
@param outputMatrix
restrainViewPort (double offsetLeft , double offsetTop , double offsetRight , double offsetBottom )
→ void
setChartDimens (double width , double height )
→ void
Sets the width and height of the chart.
setDragOffsetX (double offset )
→ void
Set an offset in dp that allows the user to drag the chart over it's
bounds on the x-axis.
setDragOffsetY (double offset )
→ void
Set an offset in dp that allows the user to drag the chart over it's
bounds on the y-axis.
setMaximumScaleX (double xScale )
→ void
Sets the maximum scale factor for the x-axis
setMaximumScaleY (double yScale )
→ void
Sets the maximum scale factor for the y-axis
setMinimumScaleX (double xScale )
→ void
Sets the minimum scale factor for the x-axis
setMinimumScaleY (double yScale )
→ void
Sets the minimum scale factor for the y-axis
setMinMaxScaleX (double minScaleX , double maxScaleX )
→ void
Sets the minimum and maximum scale factors for the x-axis
setMinMaxScaleY (double minScaleY , double maxScaleY )
→ void
setZoom1 (double scaleX , double scaleY )
→ Matrix4
Sets the scale factor to the specified values.
setZoom2 (double scaleX , double scaleY , Matrix4 outputMatrix )
→ void
setZoom3 (double scaleX , double scaleY , double x , double y )
→ Matrix4
Sets the scale factor to the specified values. x and y is pivot.
toString ()
→ String
A string representation of this object.
inherited
translate1 (List <double > transformedPts )
→ Matrix4
Post-translates to the specified points. Less Performant.
translate2 (List <double > transformedPts , Matrix4 outputMatrix )
→ void
Post-translates to the specified points. Output matrix allows for caching objects.
zoom1 (double scaleX , double scaleY )
→ Matrix4
Post-scales by the specified scale factors.
zoom2 (double scaleX , double scaleY , Matrix4 outputMatrix )
→ void
zoom3 (double scaleX , double scaleY , double x , double y )
→ Matrix4
Post-scales by the specified scale factors. x and y is pivot.
zoom4 (double scaleX , double scaleY , double x , double y , Matrix4 outputMatrix )
→ void
zoomIn1 (double x , double y )
→ Matrix4
Zooms in by 1.4f, x and y are the coordinates (in pixels) of the zoom
center.
zoomIn2 (double x , double y , Matrix4 outputMatrix )
→ void
zoomOut1 (double x , double y )
→ Matrix4
Zooms out by 0.7f, x and y are the coordinates (in pixels) of the zoom
center.
zoomOut2 (double x , double y , Matrix4 outputMatrix )
→ void