react-spectrum-charts-capstone-venn
Version:
Declarative library for composing Spectrum visualizations in React.
40 lines • 1.85 kB
TypeScript
import { FormatLocaleDefinition } from 'd3-format';
import { FontWeight } from 'vega';
import { NumberFormat } from '@spectrum-charts/vega-spec-builder';
export interface LabelDatum {
index: number;
label: string;
value: string | number;
}
/**
* Formats currency values using a currency specific locale and currency code for the position and
* type of currency symbol.
* Applies thousands and decimal separators based on the numberFormat.
* @returns string
*/
export declare const formatLocaleCurrency: (numberLocale?: FormatLocaleDefinition) => ({ value }: LabelDatum, currencyLocale: string, currencyCode: string, numberFormat: NumberFormat) => string;
/**
* Hides labels that are the same as the previous label
* @returns string
*/
export declare const formatHorizontalTimeAxisLabels: () => (datum: LabelDatum) => string;
/**
* Hides the larger granularity instead of repeating it for each tick
* @returns string
*/
export declare const formatVerticalAxisTimeLabels: () => (datum: LabelDatum) => string;
/**
* Formats a duration in seconds as HH:MM:SS.
* Function is initialized with a number locale. This ensures that the thousands separator is correct for the locale
* @param numberLocale
* @returns formatted sting (HH:MM:SS)
*/
export declare const formatTimeDurationLabels: (numberLocale?: FormatLocaleDefinition) => ({ value }: LabelDatum) => string;
export declare const expressionFunctions: {
consoleLog: (value: any) => any;
formatHorizontalTimeAxisLabels: (datum: LabelDatum) => string;
formatVerticalAxisTimeLabels: (datum: LabelDatum) => string;
getLabelWidth: (text: string, fontWeight?: FontWeight, fontSize?: number) => number;
truncateText: (text: string, maxWidth: number, fontWeight?: FontWeight, fontSize?: number) => string;
};
//# sourceMappingURL=expressionFunctions.d.ts.map