public abstract class

ChartTransform

extends Object
java.lang.Object
   ↳ com.artfulbits.aiCharts.Base.ChartTransform

Class Overview

Provides methods to transform chart coordinates to screen coordinates and back.
Example: this method draw vertical line over chart area by specified position

 void drawCursor(Canvas c, ChartArea area, double position)
 {
   PointF pt = new PointF(); 
   ChartTransform transform = ChartTransform.obtain(area);
   Rect rect = area.getSeriesBounds(); 
   transform.getPoint(position, 0, pt);
   c.drawLine(pt.x, rect.top, pt.x, rect.bottom, mCursorPaint);
 }
 ...
 

Summary

Public Constructors
ChartTransform()
Public Methods
static ChartTransform create(ChartSeries series)
Creates default transform for series by current area.
static ChartTransform create(CoordinateSystem system, Rect bounds, ChartAxis xAxis, ChartAxis yAxis)
Creates default transform by specified coordinate system.
static ChartTransform create(ChartArea area)
Creates default transform for area by current coordinate system and default axes.
abstract void getPoint(double x, double y, PointF outPoint)
Transforms chart coordinates to screen coordinates.
abstract double getX(float x, float y)
Computes X coordinate of specified point.
abstract double getY(float x, float y)
Computes Y coordinate of specified point.
static ChartTransform obtain(CoordinateSystem system, Rect bounds, ChartAxis xAxis, ChartAxis yAxis)
Obtains default transform by specified coordinate system.
static void recycle(ChartTransform transform)
Recycles obtained instance
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public ChartTransform ()

Public Methods

public static ChartTransform create (ChartSeries series)

Creates default transform for series by current area.

Parameters
series ChartSeries instance.
Returns

public static ChartTransform create (CoordinateSystem system, Rect bounds, ChartAxis xAxis, ChartAxis yAxis)

Creates default transform by specified coordinate system.

Parameters
system coordinate system
bounds frame bounds
xAxis X axis
yAxis Y axis
Returns

public static ChartTransform create (ChartArea area)

Creates default transform for area by current coordinate system and default axes.

Parameters
area ChartArea instance.
Returns

public abstract void getPoint (double x, double y, PointF outPoint)

Transforms chart coordinates to screen coordinates.

Parameters
x X coordinate
y Y coordinate
outPoint result of transformation.

public abstract double getX (float x, float y)

Computes X coordinate of specified point.

Parameters
x x coordinate of point
y y coordinate of point
Returns
  • X coordinate.

public abstract double getY (float x, float y)

Computes Y coordinate of specified point.

Parameters
x x coordinate of point
y y coordinate of point
Returns
  • Y coordinate.

public static ChartTransform obtain (CoordinateSystem system, Rect bounds, ChartAxis xAxis, ChartAxis yAxis)

Obtains default transform by specified coordinate system.

Parameters
system coordinate system
bounds frame bounds
xAxis X axis
yAxis Y axis
Returns

public static void recycle (ChartTransform transform)

Recycles obtained instance