public abstract class Utils
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static double |
DEG2RAD |
static float |
FDEG2RAD |
| Constructor and Description |
|---|
Utils() |
| Modifier and Type | Method and Description |
|---|---|
static int |
calcTextHeight(android.graphics.Paint paint,
java.lang.String demoText)
calculates the approximate height of a text, depending on a demo text
avoid repeated calls (e.g.
|
static FSize |
calcTextSize(android.graphics.Paint paint,
java.lang.String demoText)
calculates the approximate size of a text, depending on a demo text
avoid repeated calls (e.g.
|
static int |
calcTextWidth(android.graphics.Paint paint,
java.lang.String demoText)
calculates the approximate width of a text, depending on a demo text
avoid repeated calls (e.g.
|
static float |
convertDpToPixel(float dp)
This method converts dp unit to equivalent pixels, depending on device
density.
|
static int[] |
convertIntegers(java.util.List<java.lang.Integer> integers)
Converts the provided Integer List to an int array.
|
static float |
convertPixelsToDp(float px)
This method converts device specific pixels to density independent
pixels.
|
static java.lang.String[] |
convertStrings(java.util.List<java.lang.String> strings)
Converts the provided String List to a String array.
|
static void |
drawText(android.graphics.Canvas c,
java.lang.String text,
float x,
float y,
android.graphics.Paint paint,
android.graphics.PointF anchor,
float angleDegrees) |
static java.lang.String |
formatNumber(float number,
int digitCount,
boolean separateThousands)
Formats the given number to the given number of decimals, and returns the
number as a string, maximum 35 characters.
|
static java.lang.String |
formatNumber(float number,
int digitCount,
boolean separateThousands,
char separateChar)
Formats the given number to the given number of decimals, and returns the
number as a string, maximum 35 characters.
|
static int |
getClosestDataSetIndex(java.util.List<SelectionDetail> valsAtIndex,
float val,
YAxis.AxisDependency axis)
Returns the index of the DataSet that contains the closest value on the
y-axis.
|
static int |
getDecimals(float number)
Returns the appropriate number of decimals to be used for the provided
number.
|
static float |
getLineHeight(android.graphics.Paint paint) |
static float |
getLineSpacing(android.graphics.Paint paint) |
static int |
getMaximumFlingVelocity() |
static float |
getMinimumDistance(java.util.List<SelectionDetail> valsAtIndex,
float val,
YAxis.AxisDependency axis)
Returns the minimum distance from a touch-y-value (in pixels) to the
closest y-value (in pixels) that is displayed in the chart.
|
static int |
getMinimumFlingVelocity() |
static float |
getNormalizedAngle(float angle)
returns an angle between 0.f < 360.f (not less than zero, less than 360)
|
static android.graphics.PointF |
getPosition(android.graphics.PointF center,
float dist,
float angle)
Calculates the position around a center point, depending on the distance
from the center, and the angle of the position around the center.
|
static FSize |
getSizeOfRotatedRectangleByDegrees(float rectangleWidth,
float rectangleHeight,
float degrees) |
static FSize |
getSizeOfRotatedRectangleByDegrees(FSize rectangleSize,
float degrees) |
static FSize |
getSizeOfRotatedRectangleByRadians(float rectangleWidth,
float rectangleHeight,
float radians) |
static FSize |
getSizeOfRotatedRectangleByRadians(FSize rectangleSize,
float radians) |
static void |
init(android.content.Context context)
initialize method, called inside the Chart.init() method.
|
static void |
init(android.content.res.Resources res)
Deprecated.
|
static double |
nextUp(double d)
Replacement for the Math.nextUp(...) method that is only available in
HONEYCOMB and higher.
|
static void |
postInvalidateOnAnimation(android.view.View view)
Original method view.postInvalidateOnAnimation() only supportd in API >=
16, This is a replica of the code from ViewCompat.
|
static float |
roundToNextSignificant(double number)
rounds the given number to the next significant number
|
static void |
velocityTrackerPointerUpCleanUpIfNecessary(android.view.MotionEvent ev,
android.view.VelocityTracker tracker) |
public static final double DEG2RAD
public static final float FDEG2RAD
public static void init(android.content.Context context)
context - @Deprecated public static void init(android.content.res.Resources res)
res - public static float convertDpToPixel(float dp)
dp - A value in dp (density independent pixels) unit. Which we need
to convert into pixelspublic static float convertPixelsToDp(float px)
px - A value in px (pixels) unit. Which we need to convert into dbpublic static int calcTextWidth(android.graphics.Paint paint,
java.lang.String demoText)
paint - demoText - public static int calcTextHeight(android.graphics.Paint paint,
java.lang.String demoText)
paint - demoText - public static float getLineHeight(android.graphics.Paint paint)
public static float getLineSpacing(android.graphics.Paint paint)
public static FSize calcTextSize(android.graphics.Paint paint, java.lang.String demoText)
paint - demoText - public static java.lang.String formatNumber(float number,
int digitCount,
boolean separateThousands)
number - digitCount - separateThousands - set this to true to separate thousands valuespublic static java.lang.String formatNumber(float number,
int digitCount,
boolean separateThousands,
char separateChar)
number - digitCount - separateThousands - set this to true to separate thousands valuesseparateChar - a caracter to be paced between the "thousands"public static float roundToNextSignificant(double number)
number - public static int getDecimals(float number)
number - public static int[] convertIntegers(java.util.List<java.lang.Integer> integers)
integers - public static java.lang.String[] convertStrings(java.util.List<java.lang.String> strings)
strings - public static double nextUp(double d)
d - public static int getClosestDataSetIndex(java.util.List<SelectionDetail> valsAtIndex, float val, YAxis.AxisDependency axis)
valsAtIndex - all the values at a specific indexpublic static float getMinimumDistance(java.util.List<SelectionDetail> valsAtIndex, float val, YAxis.AxisDependency axis)
valsAtIndex - val - axis - public static android.graphics.PointF getPosition(android.graphics.PointF center,
float dist,
float angle)
center - dist - angle - in degrees, converted to radians internallypublic static void velocityTrackerPointerUpCleanUpIfNecessary(android.view.MotionEvent ev,
android.view.VelocityTracker tracker)
public static void postInvalidateOnAnimation(android.view.View view)
view - public static int getMinimumFlingVelocity()
public static int getMaximumFlingVelocity()
public static float getNormalizedAngle(float angle)
public static void drawText(android.graphics.Canvas c,
java.lang.String text,
float x,
float y,
android.graphics.Paint paint,
android.graphics.PointF anchor,
float angleDegrees)
public static FSize getSizeOfRotatedRectangleByDegrees(FSize rectangleSize, float degrees)
public static FSize getSizeOfRotatedRectangleByRadians(FSize rectangleSize, float radians)
public static FSize getSizeOfRotatedRectangleByDegrees(float rectangleWidth, float rectangleHeight, float degrees)
public static FSize getSizeOfRotatedRectangleByRadians(float rectangleWidth, float rectangleHeight, float radians)