@nativescript-community/ui-chart
Version:
A powerful chart / graph plugin, supporting line, bar, pie, radar, bubble, and candlestick charts as well as scaling, panning and animations.
204 lines (202 loc) • 8.16 kB
TypeScript
import { TypedArray, arrayToNativeArray as arrayToNativeArrayFn, createArrayBuffer as createArrayBufferFn, createArrayBufferOrNativeArray as createArrayBufferOrNativeArrayFn, createNativeArray as createNativeArrayFn, nativeArrayToArray as nativeArrayToArrayFn, pointsFromBuffer as pointsFromBufferFn, supportsDirectArrayBuffers as supportsDirectArrayBuffersFn } from '@nativescript-community/arraybuffers';
import { Canvas, FontMetrics, Matrix, Paint, Path, RectF } from '@nativescript-community/ui-canvas';
import { ObservableArray } from '@nativescript/core';
import { DefaultValueFormatter } from '../formatter/DefaultValueFormatter';
import { ValueFormatter } from '../formatter/ValueFormatter';
import { MPPointF } from './MPPointF';
import { MPSize } from './MPSize';
export declare const ChartTraceCategory = "NativescriptChart";
export declare enum CLogTypes {
log = 0,
info = 1,
warning = 2,
error = 3
}
export declare const CLog: (type: CLogTypes, ...args: any[]) => void;
/**
* Utilities class that has some helper methods. Needs to be initialized by
* calling Utils.init(...) before usage. Inside the Chart.init() method, this is
* done, if the Utils are used before that, Utils.init(...) needs to be called
* manually.
*
*/
export declare namespace Utils {
const density: number;
const DEG2RAD: number;
const RAD2DEG: number;
const NUMBER_EPSILON: number;
/**
* initialize method, called inside the Chart.init() method.
*
* @param context
*/
function init(): void;
/**
* This method converts dp unit to equivalent pixels, depending on device
* density. NEEDS UTILS TO BE INITIALIZED BEFORE USAGE.
*
* @param dp A value in dp (density independent pixels) unit. Which we need
* to convert into pixels
* @return A let value to represent px equivalent to dp depending on
* device density
*/
function convertDpToPixel(dp: any): number;
/**
* This method converts device specific pixels to density independent
* pixels. NEEDS UTILS TO BE INITIALIZED BEFORE USAGE.
*
* @param px A value in px (pixels) unit. Which we need to convert into db
* @return A let value to represent dp equivalent to px value
*/
function convertPixelsToDp(px: any): any;
/**
* calculates the approximate width of a text, depending on a demo text
* avoid repeated calls (e.g. inside drawing methods)
*
* @param paint
* @param demoText
* @return
*/
function calcTextWidth(paint: Paint, demoText: string): number;
/**
* calculates the approximate height of a text, depending on a demo text
* avoid repeated calls (e.g. inside drawing methods)
*
* @param paint
* @param demoText
* @return
*/
function calcTextHeight(paint: Paint, demoText: string): number;
function getLineHeightFromMetrics(fontMetrics: FontMetrics): number;
function getLineHeight(paint: Paint, fontMetrics?: FontMetrics): number;
function getLineSpacingFromMetrics(fontMetrics: FontMetrics): number;
function getLineSpacing(paint: Paint, fontMetrics?: FontMetrics): number;
/**
* calculates the approximate size of a text, depending on a demo text
* avoid repeated calls (e.g. inside drawing methods)
*
* @param paint
* @param demoText
* @param outputFSize An output variable, modified by the function.
*/
function calcTextSize(paint: Paint, demoText: any): {
width: number;
height: number;
};
function generateDefaultValueFormatter(): DefaultValueFormatter;
function getDefaultValueFormatter(): ValueFormatter;
/**
* Formats the given number to the given number of decimals, and returns the
* number as a string, maximum 35 characters.
*
* @param number
* @param digitCount
* @param separateThousands set this to true to separate thousands values
* @param separateChar a caracter to be paced between the "thousands"
* @return
*/
function formatNumber(number: any, digitCount: any, separateThousands: any, separateChar?: string): string;
/**
* rounds the given number to the next significant number
*
* @param number
* @return
*/
function roundToNextSignificant(number: any): number;
/**
* Returns the appropriate number of decimals to be used for the provided
* number.
*
* @param number
* @return
*/
function getDecimals(number: any): number;
/**
* Replacement for the Math.nextUp(...) method that is only available in
* HONEYCOMB and higher. Dat's some seeeeek sheeet.
*
* @param d
* @return
*/
function nextUp(x: any): any;
function toRadians(degrees: any): number;
/**
* Returns a recyclable MPPointF instance.
* Calculates the position around a center point, depending on the distance
* from the center, and the angle of the position around the center.
*
* @param center
* @param dist
* @param angle in degrees, converted to radians internally
* @return
*/
function getPosition(center: any, dist: any, angle: any, outputPoint?: any): any;
/**
* returns an angle between 0 < 360 (not less than zero, less than 360)
*/
function getNormalizedAngle(angle: any): number;
function drawXAxisValue(c: Canvas, text: string, x: number, y: number, paint: Paint, anchor: MPPointF, angleDegrees: number): void;
function drawMultilineText(c: Canvas, textLayout: any, x: number, y: number, anchor: MPPointF, angleDegrees: number, lineHeight: number): void;
function drawMultilineTextConstrained(c: Canvas, text: string, x: number, y: number, paint: Paint, constrainedToSize: MPSize, anchor: MPPointF, angleDegrees: number, lineHeight: number): void;
/**
* Returns a recyclable FSize instance.
* Represents size of a rotated rectangle by degrees.
*
* @param rectangleWidth
* @param rectangleHeight
* @param degrees
* @return A Recyclable FSize instance
*/
function getSizeOfRotatedRectangleByDegrees(rectangleWidth: any, rectangleHeight: any, degrees: any): {
width: number;
height: number;
};
/**
* Returns a recyclable FSize instance.
* Represents size of a rotated rectangle by radians.
*
* @param rectangleWidth
* @param rectangleHeight
* @param radians
* @return A Recyclable FSize instance
*/
function getSizeOfRotatedRectangleByRadians(rectangleWidth: any, rectangleHeight: any, radians: any): {
width: number;
height: number;
};
const supportsDirectArrayBuffers: typeof supportsDirectArrayBuffersFn;
const createArrayBuffer: typeof createArrayBufferFn;
const pointsFromBuffer: typeof pointsFromBufferFn;
const createArrayBufferOrNativeArray: typeof createArrayBufferOrNativeArrayFn;
const createNativeArray: typeof createNativeArrayFn;
const nativeArrayToArray: typeof nativeArrayToArrayFn;
const arrayToNativeArray: typeof arrayToNativeArrayFn;
function getTempArray(length: any, useInts?: boolean, canReturnBuffer?: boolean, optKey?: string): TypedArray;
function getTempRectF(): RectF;
function getTempRect(): RectF;
function getTempPath(): Path;
function getTempMatrix(): Matrix;
function getTempPaint(): Paint;
function getTemplatePaint(template: string): Paint;
function clipPathSupported(): boolean;
/**
* Calculates the sum across all values of the given array.
*
* @param values
* @return
*/
function calcSum(values: number[]): number;
/**
* Calculates the sum of positive numbers and negative numbers separately,
* across all values of the given array.
*
* @param values
* @return
*/
function calcPosNegSum(values: number[]): {
pos: number;
neg: number;
};
function calcSumToIndex(index: number, values: number[], desc: boolean): number;
function getArrayItem(array: any[] | ObservableArray<any>, index: number): any;
}