@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.
321 lines (320 loc) • 9.86 kB
TypeScript
import { Entry } from './Entry';
import { AxisDependency } from '../components/YAxis';
import { IValueFormatter } from '../formatter/IValueFormatter';
import { Highlight } from '../highlight/Highlight';
import { IDataSet } from '../interfaces/datasets/IDataSet';
export declare abstract class ChartData<U extends Entry, T extends IDataSet<U>> {
/**
* maximum y-value in the value array across all axes
*/
mYMax: number;
/**
* the minimum y-value in the value array across all axes
*/
mYMin: number;
/**
* maximum x-value in the value array
*/
mXMax: number;
/**
* minimum x-value in the value array
*/
mXMin: number;
mLeftAxisMax: number;
mLeftAxisMin: number;
mRightAxisMax: number;
mRightAxisMin: number;
/**
* array that holds all DataSets the ChartData object represents
*/
protected mDataSets: T[];
/**
* Default constructor.
*/
/**
* Constructor taking single or multiple DataSet objects.
*
* @param dataSets
*/
constructor(dataSets?: T[]);
/**
* Call this method to let the ChartData know that the underlying data has
* changed. Calling this performs all necessary recalculations needed when
* the contained data has changed.
*/
notifyDataChanged(): void;
/**
* Calc minimum and maximum y-values over all DataSets.
* Tell DataSets to recalculate their min and max y-values, this is only needed for autoScaleMinMax.
*
* @param fromX the x-value to start the calculation from
* @param toX the x-value to which the calculation should be performed
*/
calcMinMaxYRange(fromX: any, toX: any): void;
/**
* Calc minimum and maximum values (both x and y) over all DataSets.
*/
calcMinMax(): void;
/** ONLY GETTERS AND SETTERS BELOW THIS */
/**
* returns the number of LineDataSets this object contains
*/
get dataSetCount(): number;
/**
* Returns the minimum y-value for the specified axis.
*
* @param axis
* @return
*/
getYMin(axis?: any): number;
get yMin(): number;
get yMax(): number;
/**
* Returns the maximum y-value for the specified axis.
*
* @param axis
* @return
*/
getYMax(axis?: AxisDependency): number;
/**
* Returns the minimum x-value this data object contains.
*/
get xMin(): number;
/**
* Returns the maximum x-value this data object contains.
*/
get xMax(): number;
/**
* Returns all DataSet objects this ChartData object holds.
*/
get dataSets(): T[];
get visibleDataSets(): T[];
/**
* Retrieve the index of a DataSet with a specific label from the ChartData.
* Search can be case sensitive or not. IMPORTANT: This method does
* calculations at runtime, do not over-use in performance critical
* situations.
*
* @param dataSets the DataSet array to search
* @param label
* @param ignorecase if true, the search is not case-sensitive
* @return
*/
protected getDataSetIndexByLabel(dataSets: T[], label: string, ignorecase?: boolean): number;
/**
* Returns the labels of all DataSets as a string array.
*/
getDataSetLabels(): any[];
/**
* Get the Entry for a corresponding highlight object
*
* @param highlight
* @return the entry that is highlighted
*/
getEntryForHighlight(highlight: Highlight): Entry;
/**
* Get the Entry for a corresponding highlight object
*
* @param highlight
* @return the entry that is highlighted
*/
getEntryAndIndexForHighlight(highlight: Highlight): {
entry: Entry;
index: number;
};
/**
* Returns the DataSet object with the given label. Search can be case
* sensitive or not. IMPORTANT: This method does calculations at runtime.
* Use with care in performance critical situations.
*
* @param label
* @param ignorecase
* @return
*/
getDataSetByLabel(label: string, ignorecase?: boolean): T;
getDataSetByIndex(index: number): T;
/**
* Adds a DataSet dynamically.
*
* @param d
*/
addDataSet(d: T): void;
/**
* Removes the given DataSet from this data object. Also recalculates all
* minimum and maximum values. Returns true if a DataSet was removed, false
* if no DataSet could be removed.
*
* @param d
*/
removeDataSet(d: T): boolean;
/**
* Removes the DataSet at the given index in the DataSet array from the data
* object. Also recalculates all minimum and maximum values. Returns true if
* a DataSet was removed, false if no DataSet could be removed.
*
* @param index
*/
removeDataSetAtIndex(index: any): boolean;
/**
* Adds an Entry to the DataSet at the specified index.
* Entries are added to the end of the list.
*
* @param e
* @param dataSetIndex
*/
addEntry(e: any, dataSetIndex: any): void;
/**
* Adjusts the current minimum and maximum values based on the provided Entry object.
*
* @param e
* @param axis
*/
protected calcMinMaxForEntry(set: IDataSet<Entry>, e: Entry, entryIndex: number, axis: AxisDependency): void;
/**
* Adjusts the minimum and maximum values based on the given DataSet.
*
* @param d
*/
protected calcMinMaxForDataSet(d: T): void;
/**
* Removes the given Entry object from the DataSet at the specified index.
*
* @param e
* @param dataSetIndex
*/
removeEntry(e: any, dataSetIndex: any): boolean;
/**
* Removes the Entry object closest to the given DataSet at the
* specified index. Returns true if an Entry was removed, false if no Entry
* was found that meets the specified requirements.
*
* @param xValue
* @param dataSetIndex
* @return
*/
removeEntryForXValue(xValue: any, dataSetIndex: any): boolean;
/**
* Removes the Entry object closest to the given DataSet at the
* specified index. Returns true if an Entry was removed, false if no Entry
* was found that meets the specified requirements.
*
* @param xValue
* @param dataSetIndex
* @return
*/
removeEntryAtIndex(index: any, dataSetIndex: any): boolean;
/**
* Returns the DataSet that contains the provided Entry, or null, if no
* DataSet contains this Entry.
*
* @param e
* @return
*/
getDataSetForEntry(e: Entry): T;
/**
* Returns the DataSet that contains the provided Entry and the entry index, or null, if no
* DataSet contains this Entry.
*
* @param e
* @return
*/
getDataSetAndIndexForEntry(e: Entry): {
set: T;
index: number;
};
/**
* Returns all colors used across all DataSet objects this object
* represents.
*/
get colors(): any[];
/**
* Returns the index of the provided DataSet in the DataSet array of this data object, or -1 if it does not exist.
*
* @param dataSet
* @return
*/
getIndexOfDataSet(dataSet: T): number;
/**
* Returns the first DataSet from the datasets-array that has it's dependency on the left axis.
* Returns null if no DataSet with left dependency could be found.
*/
protected getFirstLeft(sets: T[]): T;
/**
* Returns the first DataSet from the datasets-array that has it's dependency on the right axis.
* Returns null if no DataSet with right dependency could be found.
*/
getFirstRight(sets: T[]): T;
/**
* Sets a custom IValueFormatter for all DataSets this data object contains.
*
* @param f
*/
set valueFormatter(f: IValueFormatter);
/**
* Sets the color of the value-text (color in which the value-labels are
* drawn) for all DataSets this data object contains.
*
* @param color
*/
set valueTextColor(color: any);
/**
* Sets the same list of value-colors for all DataSets this
* data object contains.
*
* @param colors
*/
set valueTextColors(colors: any);
/**
* Sets the Typeface for all value-labels for all DataSets this data object
* contains.
*
* @param tf
*/
set valueTypeface(tf: any);
/**
* Sets the size (in dp) of the value-text for all DataSets this data object
* contains.
*
* @param size
*/
set valueTextSize(size: any);
/**
* Enables / disables drawing values (value-text) for all DataSets this data
* object contains.
*
* @param enabled
*/
set drawValuesEnabled(enabled: any);
/**
* Enables / disables highlighting values for all DataSets this data object
* contains. If set to true, this means that values can
* be highlighted programmatically or by touch gesture.
*/
setHighlightEnabled(enabled: any): void;
/**
* Returns true if highlighting of all underlying values is enabled, false
* if not.
*/
get highlightEnabled(): boolean;
/**
* Clears this data object from all DataSets and removes all Entries. Don't
* forget to invalidate the chart after this.
*/
clearValues(): void;
/**
* Checks if this data object contains the specified DataSet. Returns true
* if so, false if not.
*
* @param dataSet
* @return
*/
contains(dataSet: any): boolean;
/**
* Returns the total entry count across all DataSet objects this data object contains.
*/
get entryCount(): number;
/**
* Returns the DataSet object with the maximum number of entries or null if there are no DataSets.
*/
get maxEntryCountSet(): T;
}