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.

189 lines (188 loc) 5.69 kB
import { Font, ObservableArray } from '@nativescript/core'; import { Entry } from './Entry'; import { IDataSet } from '../interfaces/datasets/IDataSet'; import { LegendForm } from '../components/Legend'; import { AxisDependency } from '../components/YAxis'; import { ValueFormatter } from '../formatter/ValueFormatter'; import { Color } from '@nativescript/core/color'; import { Rounding } from './DataSet'; /** * Created by Philipp Jahoda on 21/10/15. * This is the base dataset of all DataSets. It's purpose is to implement critical methods * provided by the IDataSet interface. */ export declare abstract class BaseDataSet<T extends Entry> implements IDataSet<T> { abstract init(): any; abstract readonly yMin: number; abstract readonly yMax: number; abstract readonly xMin: number; abstract readonly xMax: number; abstract calcMinMaxYRange(fromX: number, toX: number): any; abstract getEntriesForXValue(xValue: number): T[] | ObservableArray<T>; abstract getEntriesAndIndexesForXValue(xValue: number): { entry: T; index: number; }[]; abstract getEntryIndexForXValue(xValue: number, closestToY: number, rounding?: Rounding): number; abstract getEntryYValue(e: T): number; abstract getEntryIndex(e: T): number; abstract addEntry(e: T): boolean; abstract addEntryOrdered(e: T): any; abstract clear(): any; abstract readonly entryCount: number; abstract values: T[] | ObservableArray<T>; abstract getEntryForIndex(index: number): T; abstract getEntryForXValue(xValue: number, closestToY: number, rounding?: Rounding): T; abstract getEntryAndIndexForXValue(xValue: number, closestToY: number, rounding?: Rounding): { entry: T; index: number; }; abstract calcMinMax(): any; /** * property to access the "x" value of an entry for this set * */ xProperty: string; /** * property to access the "y" value of an entry for this set * */ yProperty: string; /** * property to access the "icon" value of an entry for this set * */ iconProperty: string; /** * List representing all colors that are used for this DataSet */ colors: (string | Color)[]; color: string | Color; /** * List representing all colors that are used for drawing the actual values for this DataSet */ valueColors: (string | Color)[]; /** * label that describes the DataSet or the data the DataSet represents */ label: string; /** * this specifies which axis this DataSet should be plotted against */ axisDependency: AxisDependency; /** * if true, value highlightning is enabled */ highlightEnabled: boolean; /** * custom formatter that is used instead of the auto-formatter if set */ valueFormatter: ValueFormatter; /** * the typeface used for the value text */ valueTypeface: Font; form: LegendForm; formSize: number; formLineWidth: number; formLineDashEffect: any; /** * if true, y-values are drawn on the chart */ drawValuesEnabled: boolean; /** * the offset for drawing values (in dp) */ valuesOffset: { x: number; y: number; }; /** * if true, y-icons are drawn on the chart */ drawIconsEnabled: boolean; /** * the offset for drawing icons (in dp) */ iconsOffset: { x: number; y: number; }; /** * the size of the value-text labels */ valueTextSize: number; /** * flag that indicates if the DataSet is visible or not */ visible: boolean; /** * data space from the smallest value to the bottom in percent of the total axis range */ spaceBottom: number; /** * data space from the highest value to the top in percent of the total axis range */ spaceTop: number; /** * Constructor with label. * * @param label */ constructor(label: any, xProperty?: any, yProperty?: any); getEntryXValue(e: T, entryIndex: number): any; getEntryIcon(e: T): any; /** * Use this method to tell the data set that the underlying data has changed. */ notifyDataSetChanged(): void; /** * ###### ###### COLOR GETTING RELATED METHODS ##### ###### */ getColor(index?: number): string | Color; /** * Adds a new color to the colors array of the DataSet. * * @param color */ addColor(value: string | Color): void; /** * Sets a color with a specific alpha value. * * @param color * @param alpha from 0-255 */ setColor(color: string | Color, alpha?: number): void; /** * Sets colors with a specific alpha value. * * @param colors * @param alpha */ setColors(colors: any, alpha?: number): void; /** * Resets all colors of this DataSet and recreates the colors array. */ resetColors(): void; /** * ###### ###### OTHER STYLING RELATED METHODS ##### ###### */ get needsFormatter(): boolean; set valueTextColor(color: any); set valueTextColors(colors: any); getValueTextColor(index?: number): string | Color; /** * the shader to be used for filling the line surface */ fillShader: any; /** * ###### ###### DATA RELATED METHODS ###### ###### */ getIndexInEntries(xIndex: any): number; removeFirst(): any; removeLast(): any; removeEntryByXValue(xValue: any): any; abstract removeEntry(e: T): any; abstract removeEntryAtIndex(index: number): any; contains(e: T): boolean; }