com.androidplot.util
Class ValPixConverter

java.lang.Object
  extended by com.androidplot.util.ValPixConverter

public class ValPixConverter
extends Object

Utility methods for converting pixel coordinates into real values and vice versa.


Constructor Summary
ValPixConverter()
           
 
Method Summary
static double pixToVal(float pix, double min, double max, float lengthPix, boolean flip)
          Convert a value in pixels to the type passed into min/max
static double range(double min, double max)
           
static double valPerPix(double min, double max, float lengthPix)
           
static float valToPix(double val, double min, double max, float lengthPix, boolean flip)
           
static android.graphics.PointF valToPix(Number x, Number y, android.graphics.RectF plotArea, Number minX, Number maxX, Number minY, Number maxY)
          Converts a real value into a pixel value.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ValPixConverter

public ValPixConverter()
Method Detail

valToPix

public static float valToPix(double val,
                             double min,
                             double max,
                             float lengthPix,
                             boolean flip)

range

public static double range(double min,
                           double max)

valPerPix

public static double valPerPix(double min,
                               double max,
                               float lengthPix)

pixToVal

public static double pixToVal(float pix,
                              double min,
                              double max,
                              float lengthPix,
                              boolean flip)
Convert a value in pixels to the type passed into min/max

Parameters:
pix -
min -
max -
lengthPix -
flip - True if the axis should be reversed before calculated. This is the case with the y axis for screen coords.
Returns:

valToPix

public static android.graphics.PointF valToPix(Number x,
                                               Number y,
                                               android.graphics.RectF plotArea,
                                               Number minX,
                                               Number maxX,
                                               Number minY,
                                               Number maxY)
Converts a real value into a pixel value.

Parameters:
x - Real d (domain) component of the point to convert.
y - Real y (range) component of the point to convert.
plotArea -
minX - Minimum visible real value on the d (domain) axis.
maxX - Maximum visible real value on the y (domain) axis.
minY - Minimum visible real value on the y (range) axis.
maxY - Maximum visible real value on the y (range axis.
Returns:


Copyright © 2010-2013 androidplot.com. All Rights Reserved.