@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.
131 lines (129 loc) • 4.47 kB
TypeScript
import { EventData } from '@nativescript/core';
import { GestureTypes } from '@nativescript/core/ui/gestures';
import { Chart } from './Chart';
import { ChartData } from '../data/ChartData';
import { Entry } from '../data/Entry';
import { IDataSet } from '../interfaces/datasets/IDataSet';
import { PieRadarChartTouchListener } from '../listener/PieRadarChartTouchListener';
import { MPPointF } from '../utils/MPPointF';
/**
* View that represents a pie chart. Draws cake like slices.
*
*/
export declare abstract class PieRadarChartBase<U extends Entry, D extends IDataSet<U>, T extends ChartData<U, D>> extends Chart<U, D, T> {
chartTouchListener: PieRadarChartTouchListener;
/**
* holds the normalized version of the current rotation angle of the chart
*/
private mRotationAngle;
/**
* holds the raw version of the current rotation angle of the chart
*/
private mRawRotationAngle;
/**
* flag that indicates if rotation is enabled or not
*/
protected mRotateEnabled: boolean;
/**
* Sets the minimum offset (padding) around the chart, defaults to 0
*/
minOffset: number;
drawHighlight: boolean;
protected init(): void;
getOrCreateTouchListener(): PieRadarChartTouchListener;
protected calcMinMax(): void;
get maxVisibleValueCount(): number;
notifyDataSetChanged(): void;
calculateOffsets(): void;
/**
* Returns the angle relative to the chart center for the given polet on the
* chart in degrees. The angle is always between 0 and 360°, 0° is NORTH,
* 90° is EAST, ...
*
* @param x
* @param y
* @return
*/
getAngleForPoint(x: any, y: 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
*/
getPosition(center: MPPointF, dist: number, angle: number, outputPoint?: MPPointF): MPPointF;
/**
* Returns the distance of a certain polet on the chart to the center of the
* chart.
*
* @param x
* @param y
* @return
*/
distanceToCenter(x: number, y: number): number;
/**
* Returns the xIndex for the given angle around the center of the chart.
* Returns -1 if not found / outofbounds.
*
* @param angle
* @return
*/
abstract getIndexForAngle(angle: any): any;
set highlightPerTapEnabled(enabled: boolean);
get highlightPerTapEnabled(): boolean;
/**
* Set an offset for the rotation of the RadarChart in degrees. Default 270
* --> top (NORTH)
*
* @param angle
*/
set rotationAngle(angle: number);
/**
* gets a normalized version of the current rotation angle of the pie chart,
* which will always be between 0.0 < 360.0
*/
get rotationAngle(): number;
/**
* gets the raw version of the current rotation angle of the pie chart the
* returned value could be any value, negative or positive, outside of the
* 360 degrees. this is used when working with rotation direction, mainly by
* gestures and animations.
*/
get rawRotationAngle(): number;
/**
* Set this to true to enable the rotation / spinning of the chart by touch.
* Set it to false to disable it. Default: true
*
* @param enabled
*/
set rotationEnabled(enabled: boolean);
/**
* Returns true if rotation of the chart by touch is enabled, false if not.
*/
get rotationEnabled(): boolean;
/**
* returns the diameter of the pie- or radar-chart
*/
get diameter(): number;
/**
* Returns the radius of the chart in pixels.
*/
abstract radius: number;
/**
* Returns the required offset for the chart legend.
*/
protected abstract requiredLegendOffset: number;
/**
* Returns the base offset needed for the chart without calculating the
* legend size.
*/
protected abstract requiredBaseOffset: number;
get yChartMax(): number;
get yChartMin(): number;
addEventListener(arg: string | GestureTypes, callback: (data: EventData) => void, thisArg?: any): void;
removeEventListener(arg: string | GestureTypes, callback?: any, thisArg?: any): void;
}