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.

90 lines 2.93 kB
/** * Class to format all values before they are drawn as labels. */ export class ValueFormatter { /** * Called when drawing any label, used to change numbers into formatted strings. * * @param value float to be formatted * @return formatted string label */ getFormattedValue(value, entry) { return value + ''; } /** * Used to draw axis labels, calls {@link #getFormattedValue} by default. * * @param value float to be formatted * @param axis axis being labeled * @return formatted string label */ getAxisLabel(value, axis) { return this.getFormattedValue(value); } /** * Used to draw bar labels, calls {@link #getFormattedValue} by default. * * @param value current value to be formatted * @return formatted string label */ getBarLabel(value, entry) { return this.getFormattedValue(value, entry); } /** * Used to draw stacked bar labels, calls {@link #getFormattedValue} by default. * * @param value current value to be formatted * @param entry stacked entry being labeled, contains all Y values * @return formatted string label */ getBarStackedLabel(value, entry) { return this.getFormattedValue(value, entry); } /** * Used to draw line and scatter labels, calls {@link #getFormattedValue} by default. * * @param entry point being labeled, contains X value * @return formatted string label */ getPointLabel(value, entry) { return this.getFormattedValue(value, entry); } /** * Used to draw pie value labels, calls {@link #getFormattedValue} by default. * * @param value float to be formatted, may have been converted to percentage * @param entry slice being labeled, contains original, non-percentage Y value * @return formatted string label */ getPieLabel(value, entry) { return this.getFormattedValue(value, entry); } /** * Used to draw radar value labels, calls {@link #getFormattedValue} by default. * * @param entry entry being labeled * @return formatted string label */ getRadarLabel(value, entry) { return this.getFormattedValue(value, entry); } /** * Used to draw bubble size labels, calls {@link #getFormattedValue} by default. * * @param entry bubble being labeled, also contains X and Y values * @return formatted string label */ getBubbleLabel(value, entry) { return this.getFormattedValue(value, entry); } /** * Used to draw high labels, calls {@link #getFormattedValue} by default. * * @param entry candlestick being labeled * @return formatted string label */ getCandleLabel(value, entry) { return this.getFormattedValue(value, entry); } } //# sourceMappingURL=ValueFormatter.js.map