import { AbstractFormatter } from '../Formatter'; import { TypedValue, DataType } from '../DataPrimitive'; import { DataPoint } from '../DataPoint'; export interface RangesConfig { from?: number; value: any; to?: number; } /** * Formatter function that takes the list of ranges and a defaultValue (if no range is found) * and returns a function that takes a value and returns the range value if found, or the defaultValue if present. * * If neither are present, it returns the original value. * * The range fitting follows this criteria: `range.from <= value < range.to` * * A range can be defined as either a closed bound range: `{ from: 10, to: 20, value: 'foo' }` * or an open bound range: * `{ to: 20, value: 'bar' }` (open lower bound) * `{ from: 100, value: 'oof' }` (open upper bound) * * ```js * primary | seriesByIndex(0) | lastPoint()', // returns 103 * colorOption: '> deltaValue | rangeValue(colorThresholds)', // returns '#FF00FF' * }} * dataSources={{ * primary: { * data: { * columns: [ * ['1', '103'], ['2018-08-19T00:00:00.000+00:00', '2018-08-20T00:00:00.000+00:00'], * ], * fields: [{ name: 'foo', }, { name: '_time' }], * } * }, * }} * /> * ``` * @extends AbstractFormatter */ export declare class RangeValue extends AbstractFormatter { private readonly ranges; private readonly defaultValue; constructor(ranges: RangesConfig[], defaultValue?: any); private findMatchingRange; protected formatTypedValue(p: DataPoint<'number'>): TypedValue; }