@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.
101 lines (100 loc) • 3.95 kB
TypeScript
import { TypedArray } from '@nativescript-community/arraybuffers';
import { Canvas, LinearGradient, Matrix, Paint, Path } from '@nativescript-community/ui-canvas';
import { Color, ImageSource } from '@nativescript/core';
import { ChartAnimator } from '../animation/ChartAnimator';
import { LineChart } from '..';
import { LineDataSet } from '../data/LineDataSet';
import { Highlight } from '../highlight/Highlight';
import { ILineDataSet } from '../interfaces/datasets/ILineDataSet';
import { Transformer } from '../utils/Transformer';
import { ViewPortHandler } from '../utils/ViewPortHandler';
import { LineRadarRenderer } from './LineRadarRenderer';
interface XYPoint {
x: number;
y: number;
}
export declare function splineCurve(firstPoint: XYPoint, middlePoint: XYPoint, afterPoint: XYPoint, tension: number): {
previous: {
x: number;
y: number;
};
next: {
x: number;
y: number;
};
};
export declare class DataSetImageCache {
private circleBitmaps;
/**
* Sets up the cache, returns true if a change of cache was required.
*
* @param set
* @return
*/
init(set: ILineDataSet): boolean;
/**
* Fills the cache with bitmaps for the given dataset.
*
* @param set
* @param drawCircleHole
* @param drawTransparentCircleHole
*/
fill(set: ILineDataSet, renderPaint: Paint, circlePaintInner: Paint, drawCircleHole: boolean, drawTransparentCircleHole: boolean): void;
/**
* Returns the cached Bitmap at the given index.
*
* @param index
* @return
*/
getBitmap(index: any): any;
}
export declare class LineChartRenderer extends LineRadarRenderer {
mChart: LineChart;
/**
* palet for the inner circle of the value indicators
*/
protected mCirclePaintInner: Paint;
/**
* Bitmap object used for drawing the paths (otherwise they are too long if
* rendered directly on the canvas)
*/
protected mDrawBitmap: WeakRef<ImageSource>;
/**
* on this canvas, the paths are rendered, it is initialized with the
* pathBitmap
*/
protected mBitmapCanvas: Canvas;
private mLineBuffer;
protected static mFillPath: Path;
protected get fillPath(): Path;
/**
* cache for the circle bitmaps of all datasets
*/
private mImageCaches;
constructor(chart: LineChart, animator: ChartAnimator, viewPortHandler: ViewPortHandler);
get circlePaintInner(): Paint;
drawData(c: Canvas): void;
protected drawDataSet(c: Canvas, dataSet: LineDataSet): boolean;
generateHorizontalBezierPath(dataSet: ILineDataSet, outputPath: Path): (number | number[] | TypedArray)[];
generateCubicPath(dataSet: ILineDataSet, outputPath: Path): (number | number[] | TypedArray)[];
generateLinearPath(dataSet: ILineDataSet, outputPath: Path): (number | number[] | TypedArray)[];
getMultiColorsShader(colors: {
color: string | Color;
[k: string]: any;
}[], points: any, trans: Transformer, dataSet: LineDataSet): LinearGradient;
lastLinePath: Path;
protected draw(c: Canvas, dataSet: LineDataSet): boolean;
drawLines(canvas: Canvas, points: number[], offest: number, length: number, paint: Paint, matrix?: Matrix): void;
protected drawFill(c: Canvas, dataSet: ILineDataSet, spline: Path, trans: Transformer, min: number, max: number, color?: any, fillMin?: number): void;
drawValuesForDataset(c: Canvas, dataSet: LineDataSet, dataSetIndex: number): void;
drawValues(c: Canvas): void;
drawExtras(c: Canvas): void;
protected drawCirclesForDataset(c: Canvas, dataSet: LineDataSet): void;
protected drawCircles(c: Canvas): void;
drawHighlighted(c: Canvas, indices: Highlight[], actualDraw?: boolean): void;
/**
* Releases the drawing bitmap. This should be called when {@link LineChart#onDetachedFromWindow()}.
*/
releaseBitmap(): void;
}
export {};