UNPKG

simple-ascii-chart

Version:
41 lines (40 loc) 1.69 kB
import { CHART } from '../constants/index.js'; import { Color, ColorGetter, Formatter, MultiLine } from '../types/index.js'; /** * Maps a color name to its corresponding ANSI color code. * @param {Color} color - The color to map. * @returns {string} - The ANSI escape code for the specified color. */ export declare const getAnsiColor: (color: Color) => string; /** * Configures and applies colors to chart symbols based on the specified color or series. * @param {Color | Color[] | ColorGetter | undefined} color - The color setting for the series. * @param {number} series - The index of the series. * @param {Partial<typeof CHART> | undefined} chartSymbols - Custom symbols for the chart, if any. * @param {MultiLine} input - The dataset used in the chart. * @param {boolean} [fillArea] - If true, fills the area under the plot with the chart's fill symbol. * @returns {object} - An object with chart symbols applied in the specified color(s). */ export declare const getChartSymbols: (color: Color | Color[] | undefined | ColorGetter, series: number, chartSymbols: Partial<typeof CHART> | void, input: MultiLine, fillArea?: boolean) => { we: string; wns: string; ns: string; nse: string; wsn: string; sne: string; area: string; } | { we: string; wns: string; ns: string; nse: string; wsn: string; sne: string; area: string; }; /** * Formats a number for display, converting values >= 1000 to a "k" notation. * @param {number} value - The value to format. * @returns {string | number} - The formatted value as a string with "k" for thousands or as a rounded number. */ export declare const defaultFormatter: Formatter;