@uwdata/mosaic-sql
Version:
SQL query construction and analysis.
30 lines • 1.25 kB
TypeScript
import type { ExprValue } from '../types.js';
import { ExprNode } from '../ast/node.js';
export interface ScaleTransform<T> {
apply: (value: T) => number;
invert: (value: number) => T;
sqlApply: (value: ExprValue) => ExprNode;
sqlInvert: (value: ExprNode) => ExprNode;
}
export type ScaleType = 'identity' | 'linear' | 'log' | 'symlog' | 'sqrt' | 'pow' | 'time' | 'utc';
export type ScaleDomain = [number, number] | [Date, Date];
export interface ScaleOptions {
/** The scale type, such as `'linear'`, `'log'`, etc. */
type: ScaleType;
/** The scale domain, as an array of start and end data values. */
domain?: ScaleDomain;
/**
* The scale range, as an array of start and end screen pixels.
* The range may be omitted for *identity* scales.
*/
range?: [number, number];
/** The base of the logarithm. For `'log'` scales only. */
base?: number;
/** The constant parameter. For `'symlog'` scales only. */
constant?: number;
/** The exponent parameter. For `'pow'` scales only. */
exponent?: number;
}
export type Scale<T> = ScaleTransform<T> & ScaleOptions;
export declare function scaleTransform<T>(options: ScaleOptions): Scale<T>;
//# sourceMappingURL=scales.d.ts.map