@adaptabletools/adaptable
Version:
Powerful AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements
80 lines (79 loc) • 2.55 kB
TypeScript
/**
* Numeric scale primitives shared by every numeric Styled Column type
* (Gradient, Percent Bar, Bullet Chart, Range Bar).
*
* These types describe how a column's numeric scale is resolved (via
* literal numbers, dynamic column-wide aggregates, or comparison against
* another column) and how that scale is segmented into coloured ranges.
*/
/**
* Symbolic range endpoints that resolve to a value computed across column's visible rows (rather than hard-coded number): Col-Min, Col-Max, Col-Avg, Col-Median
*/
export type DynamicRangeEndpoint = 'Col-Min' | 'Col-Max' | 'Col-Avg' | 'Col-Median';
/**
* Whether the Range is Number or Percent based
*/
export type RangeValueType = 'Number' | 'Percentage';
/**
* Defines Colours to show in Gradient, Percent Bar and Bullet Chart Styles
*/
export interface CellColorRange {
/**
* Start of Range, can be literal number or DynamicRangeEndpoint
*/
Min: number | DynamicRangeEndpoint;
/**
* End of Range, can be literal number or DynamicRangeEndpoint
*/
Max: number | DynamicRangeEndpoint;
/**
* Cell colour to use for values that fall inside Range
*/
Color: string;
/**
* Reverses the alpha ramp **within this range only** — values at the *low*
* end render saturated, values at the *high* end render faint.
*
* Useful as a Gradient Style option when the natural reading is
* "lower-is-darker" (e.g. lower trade IDs are older / more important, so
* deserve more visual emphasis than newer ones).
*
* Only honoured by Gradient Style.
*/
ReverseGradient?: boolean;
}
/**
* Enables a Percent Bar or Gradient Style to use another column in its calculations
*/
export interface ColumnComparison {
/**
* Start value - either numeric value or Column ID
*/
MinValue: number | string;
/**
* End value - either numeric value or Column ID
*/
MaxValue: number | string;
/**
* Colour to use for the Comparison
*/
Color: string;
}
/**
* Base type for Numeric Styled Columns (i.e. Gradient and Percent Bar)
*/
export interface NumericStyledColumn {
/**
* Ranges (e.g. to create traffic light effect)
*/
CellRanges?: CellColorRange[];
/**
* Compares Cell values to another Column
*/
ColumnComparison?: ColumnComparison;
/**
* Used with Ranges; can be Number (any number or Col-Min/Col-Max) or 'Percentage' (values 0-100)
* @defaultValue Number
*/
RangeValueType?: RangeValueType;
}