@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.
97 lines (96 loc) • 4.27 kB
TypeScript
import { BarLineChartBase } from './BarLineChartBase';
import { BarData } from '../data/BarData';
import { BarEntry } from '../data/BarEntry';
import { BarDataProvider } from '../interfaces/dataprovider/BarDataProvider';
import { Entry } from '../data/Entry';
import { BarDataSet } from '../data/BarDataSet';
import { Highlight } from '../highlight/Highlight';
import { BarChartRenderer } from '../renderer/BarChartRenderer';
import { Canvas, Paint, RectF } from '@nativescript-community/ui-canvas';
import { IBarDataSet } from '../interfaces/datasets/IBarDataSet';
import { BaseCustomRenderer } from '../renderer/DataRenderer';
export interface CustomRenderer extends BaseCustomRenderer {
drawBar?: (c: Canvas, e: BarEntry, dataSet: IBarDataSet, left: number, top: number, right: number, bottom: number, paint: Paint) => void;
drawHighlight?: (c: Canvas, e: Highlight, left: number, top: number, right: number, bottom: number, paint: Paint) => void;
}
export declare class BarChart extends BarLineChartBase<Entry, BarDataSet, BarData> implements BarDataProvider {
protected mRenderer: BarChartRenderer;
/**
* Set this to true to make the highlight operation full-bar oriented, false to make it highlight single values (relevant
* only for stacked). If enabled, highlighting operations will highlight the whole bar, even if only a single stack entry
* was tapped.
* Default: false
*
* @param enabled
*/
highlightFullBarEnabled: boolean;
/**
* Adds half of the bar width to each side of the x-axis range in order to allow the bars of the barchart to be
* fully displayed.
* Default: false
*/
fitBars: boolean;
/**
* if set to true, all values are drawn above their bars, instead of below their top
*/
drawValueAboveBarEnabled: boolean;
/**
* if set to true, a grey area is drawn behind each bar that indicates the maximum value
*/
drawBarShadowEnabled: boolean;
customRenderer: CustomRenderer;
protected init(): void;
protected calcMinMax(): void;
/**
* Returns the Highlight object (contains x-index and DataSet index) of the selected value at the given touch
* point
* inside the BarChart.
*
* @param x
* @param y
* @return
*/
getHighlightsByTouchPoint(x: number, y: number): Highlight<Entry>[];
/**
* Returns the Highlight object (contains x-index and DataSet index) of the selected value at the given touch
* point
* inside the BarChart.
*
* @param x
* @param y
* @return
*/
getHighlightByTouchPoint(x: number, y: number): Highlight;
/**
* Returns the bounding box of the specified Entry in the specified DataSet. Returns null if the Entry could not be
* found in the charts data.
*
* @param e
* @return
*/
getBarBounds(e: BarEntry): RectF;
/**
* Highlights the value at the given x-value in the given DataSet. Provide
* -1 as the dataSetIndex to undo all highlighting.
*
* @param x
* @param dataSetIndex
* @param stackIndex the index inside the stack - only relevant for stacked entries
* @param callListener
*/
highlightValue(x: number, dataSetIndex: number, stackIndex: number, callListener?: boolean): void;
get barData(): BarData;
/**
* Groups all BarDataSet objects this data object holds together by modifying the x-value of their entries.
* Previously set x-values of entries will be overwritten. Leaves space between bars and groups as specified
* by the parameters.
* Calls notifyDataSetChanged() afterwards.
*
* @param fromX the starting polet on the x-axis where the grouping should begin
* @param groupSpace the space between groups of bars in values (not pixels) e.g. 0.8f for bar width 1
* @param barSpace the space between individual bars in values (not pixels) e.g. 0.1 for bar width 1
* @param centered whether to group bar around x values or between (default is false)
* @param groupCondensed whether to condensed grouped bar (no space for "0" bars)
*/
groupBars(fromX: any, groupSpace: any, barSpace: any, centered?: any, groupCondensed?: any): void;
}