UNPKG

@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.

87 lines (86 loc) 3.05 kB
import { ImageSource } from '@nativescript/core'; import { Canvas, Paint, RectF } from '@nativescript-community/ui-canvas'; import { DataRenderer } from './DataRenderer'; import { ChartAnimator } from '../animation/ChartAnimator'; import { PieChart } from '../charts/PieChart'; import { Highlight } from '../highlight/Highlight'; import { IPieDataSet } from '../interfaces/datasets/IPieDataSet'; import { MPPointF } from '../utils/MPPointF'; import { ViewPortHandler } from '../utils/ViewPortHandler'; export declare class PieChartRenderer extends DataRenderer { protected mChart: PieChart; /** * Bitmap for drawing the center hole */ protected mDrawBitmap: WeakRef<ImageSource>; protected mBitmapCanvas: Canvas; /** * palet for the hole in the center of the pie chart and the transparent * circle */ protected mHolePaint: Paint; protected mTransparentCirclePaint: Paint; /** * palet object for the text that can be displayed in the center of the * chart */ private mCenterTextPaint; /** * palet object used for drwing the slice-text */ private mEntryLabelsPaint; private mCenterTextLayout; private mCenterTextLastValue; private mCenterTextLastBounds; protected get centerTextLastBounds(): RectF; private mRectBuffer; protected get rectBuffer(): RectF[]; constructor(chart: PieChart, animator: ChartAnimator, viewPortHandler: ViewPortHandler); get centerTextPaint(): Paint; get entryLabelsPaint(): Paint; get transparentCirclePaint(): Paint; get holePaint(): Paint; get valuePaint(): Paint; drawData(c: Canvas): void; protected calculateMinimumRadiusForSpacedSlice(center: MPPointF, radius: any, angle: any, arcStartPointX: any, arcStartPointY: any, startAngle: any, sweepAngle: any): number; /** * Calculates the sliceSpace to use based on visible values and their size compared to the set sliceSpace. * * @param dataSet * @return */ protected getSliceSpace(dataSet: IPieDataSet): number; protected drawDataSet(c: Canvas, dataSet: IPieDataSet): boolean; drawValues(c: Canvas): void; /** * Draws an entry label at the specified position. * * @param c * @param label * @param x * @param y */ protected drawEntryLabel(c: Canvas, label: any, x: any, y: any, paint: Paint): void; drawExtras(c: Canvas): void; /** * Draws the hole in the center of the chart and the transparent circle / * hole. */ protected drawHole(c: Canvas): void; /** * Draws the description text in the center of the pie chart makes most * sense when center-hole is enabled. */ protected drawCenterText(c: Canvas): void; drawHighlighted(c: Canvas, indices: Highlight[]): void; /** * This gives all pie-slices a rounded edge. * * @param c */ protected drawRoundedSlices(c: Canvas): void; /** * Releases the drawing bitmap. */ releaseBitmap(): void; }