@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.
30 lines • 825 B
JavaScript
import { ValueFormatter } from './ValueFormatter';
import format from 'number-format.js';
/**
* Created by philipp on 02/06/16.
*/
export class DefaultAxisValueFormatter extends ValueFormatter {
/**
* Constructor that specifies to how many digits the value should be
* formatted.
*
* @param digits
*/
constructor(digits) {
super();
this.setup(digits);
}
setup(digits) {
this.decimalDigits = digits;
let b = '';
for (let i = 0; i < digits; i++) {
b += '0';
}
// Requires decimal separator in order to avoid zero format issues
this.mFormat = '###,###,###,##0.' + b;
}
getFormattedValue(value) {
return format(this.mFormat, value);
}
}
//# sourceMappingURL=DefaultAxisValueFormatter.js.map