rules:
# Replace stock eslint rules with typescript-eslint equivalents for proper
# TypeScript support.
+ indent: "off"
+ "@typescript-eslint/indent": ["error", 2]
no-use-before-define: "off"
'@typescript-eslint/no-use-before-define': "error"
no-shadow: "off"
export type TimeUnit = 'millisecond' | 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year';
export interface DateAdapter {
- // Override one or multiple of the methods to adjust to the logic of the current date library.
- override(members: Partial<DateAdapter>): void;
- readonly options: unknown;
+ // Override one or multiple of the methods to adjust to the logic of the current date library.
+ override(members: Partial<DateAdapter>): void;
+ readonly options: unknown;
- /**
- * Returns a map of time formats for the supported formatting units defined
- * in Unit as well as 'datetime' representing a detailed date/time string.
- * @returns {{string: string}}
- */
- formats(): { [key: string]: string };
- /**
- * Parses the given `value` and return the associated timestamp.
- * @param {unknown} value - the value to parse (usually comes from the data)
- * @param {string} [format] - the expected data format
- */
- parse(value: unknown, format?: TimeUnit): number | null;
- /**
- * Returns the formatted date in the specified `format` for a given `timestamp`.
- * @param {number} timestamp - the timestamp to format
- * @param {string} format - the date/time token
- * @return {string}
- */
- format(timestamp: number, format: TimeUnit): string;
- /**
- * Adds the specified `amount` of `unit` to the given `timestamp`.
- * @param {number} timestamp - the input timestamp
- * @param {number} amount - the amount to add
- * @param {Unit} unit - the unit as string
- * @return {number}
- */
- add(timestamp: number, amount: number, unit: TimeUnit): number;
- /**
- * Returns the number of `unit` between the given timestamps.
- * @param {number} a - the input timestamp (reference)
- * @param {number} b - the timestamp to subtract
- * @param {Unit} unit - the unit as string
- * @return {number}
- */
- diff(a: number, b: number, unit: TimeUnit): number;
- /**
- * Returns start of `unit` for the given `timestamp`.
- * @param {number} timestamp - the input timestamp
- * @param {Unit|'isoWeek'} unit - the unit as string
- * @param {number} [weekday] - the ISO day of the week with 1 being Monday
- * and 7 being Sunday (only needed if param *unit* is `isoWeek`).
- * @return {number}
- */
- startOf(timestamp: number, unit: TimeUnit | 'isoWeek', weekday?: number): number;
- /**
- * Returns end of `unit` for the given `timestamp`.
- * @param {number} timestamp - the input timestamp
- * @param {Unit|'isoWeek'} unit - the unit as string
- * @return {number}
- */
- endOf(timestamp: number, unit: TimeUnit | 'isoWeek'): number;
+ /**
+ * Returns a map of time formats for the supported formatting units defined
+ * in Unit as well as 'datetime' representing a detailed date/time string.
+ * @returns {{string: string}}
+ */
+ formats(): { [key: string]: string };
+ /**
+ * Parses the given `value` and return the associated timestamp.
+ * @param {unknown} value - the value to parse (usually comes from the data)
+ * @param {string} [format] - the expected data format
+ */
+ parse(value: unknown, format?: TimeUnit): number | null;
+ /**
+ * Returns the formatted date in the specified `format` for a given `timestamp`.
+ * @param {number} timestamp - the timestamp to format
+ * @param {string} format - the date/time token
+ * @return {string}
+ */
+ format(timestamp: number, format: TimeUnit): string;
+ /**
+ * Adds the specified `amount` of `unit` to the given `timestamp`.
+ * @param {number} timestamp - the input timestamp
+ * @param {number} amount - the amount to add
+ * @param {Unit} unit - the unit as string
+ * @return {number}
+ */
+ add(timestamp: number, amount: number, unit: TimeUnit): number;
+ /**
+ * Returns the number of `unit` between the given timestamps.
+ * @param {number} a - the input timestamp (reference)
+ * @param {number} b - the timestamp to subtract
+ * @param {Unit} unit - the unit as string
+ * @return {number}
+ */
+ diff(a: number, b: number, unit: TimeUnit): number;
+ /**
+ * Returns start of `unit` for the given `timestamp`.
+ * @param {number} timestamp - the input timestamp
+ * @param {Unit|'isoWeek'} unit - the unit as string
+ * @param {number} [weekday] - the ISO day of the week with 1 being Monday
+ * and 7 being Sunday (only needed if param *unit* is `isoWeek`).
+ * @return {number}
+ */
+ startOf(timestamp: number, unit: TimeUnit | 'isoWeek', weekday?: number): number;
+ /**
+ * Returns end of `unit` for the given `timestamp`.
+ * @param {number} timestamp - the input timestamp
+ * @param {Unit|'isoWeek'} unit - the unit as string
+ * @return {number}
+ */
+ endOf(timestamp: number, unit: TimeUnit | 'isoWeek'): number;
}
export const _adapters: {
- _date: DateAdapter;
+ _date: DateAdapter;
};
}
export interface AnimationEvent {
- chart: Chart;
- numSteps: number;
- initial: boolean;
- currentStep: number;
+ chart: Chart;
+ numSteps: number;
+ initial: boolean;
+ currentStep: number;
}
export class Animator {
import { Point } from './geometric';
export interface Element<T = AnyObject, O = AnyObject> {
- readonly x: number;
- readonly y: number;
- readonly active: boolean;
- readonly options: O;
+ readonly x: number;
+ readonly y: number;
+ readonly active: boolean;
+ readonly options: O;
- tooltipPosition(useFinalPosition?: boolean): Point;
- hasValue(): boolean;
- getProps<P extends (keyof T)[]>(props: P, final?: boolean): Pick<T, P[number]>;
+ tooltipPosition(useFinalPosition?: boolean): Point;
+ hasValue(): boolean;
+ getProps<P extends (keyof T)[]>(props: P, final?: boolean): Pick<T, P[number]>;
}
export const Element: {
- prototype: Element;
- new <T = AnyObject, O = AnyObject>(): Element<T, O>;
+ prototype: Element;
+ new <T = AnyObject, O = AnyObject>(): Element<T, O>;
};
export function unclipArea(ctx: CanvasRenderingContext2D): void;
export interface DrawPointOptions {
- pointStyle: PointStyle;
- rotation?: number;
- radius: number;
- borderWidth: number;
+ pointStyle: PointStyle;
+ rotation?: number;
+ radius: number;
+ borderWidth: number;
}
export function drawPoint(ctx: CanvasRenderingContext2D, options: DrawPointOptions, x: number, y: number): void;
export function toFontString(font: { size: number; family: string; style?: string; weight?: string }): string | null;
export interface RenderTextOpts {
- /**
- * The fill color of the text. If unset, the existing
- * fillStyle property of the canvas is unchanged.
- */
- color?: Color;
-
- /**
- * The width of the strikethrough / underline
- * @default 2
- */
- decorationWidth?: number;
-
- /**
- * The max width of the text in pixels
- */
- maxWidth?: number;
-
- /**
- * A rotation to be applied to the canvas
- * This is applied after the translation is applied
- */
- rotation?: number;
-
- /**
- * Apply a strikethrough effect to the text
- */
- strikethrough?: boolean;
-
- /**
- * The color of the text stroke. If unset, the existing
- * strokeStyle property of the context is unchanged
- */
- strokeColor?: Color;
-
- /**
- * The text stroke width. If unset, the existing
- * lineWidth property of the context is unchanged
- */
- strokeWidth?: number;
-
- /**
- * The text alignment to use. If unset, the existing
- * textAlign property of the context is unchanged
- */
- textAlign: CanvasTextAlign;
-
- /**
- * The text baseline to use. If unset, the existing
- * textBaseline property of the context is unchanged
- */
- textBaseline: CanvasTextBaseline;
-
- /**
- * If specified, a translation to apply to the context
- */
- translation?: [number, number];
-
- /**
- * Underline the text
- */
- underline?: boolean;
+ /**
+ * The fill color of the text. If unset, the existing
+ * fillStyle property of the canvas is unchanged.
+ */
+ color?: Color;
+
+ /**
+ * The width of the strikethrough / underline
+ * @default 2
+ */
+ decorationWidth?: number;
+
+ /**
+ * The max width of the text in pixels
+ */
+ maxWidth?: number;
+
+ /**
+ * A rotation to be applied to the canvas
+ * This is applied after the translation is applied
+ */
+ rotation?: number;
+
+ /**
+ * Apply a strikethrough effect to the text
+ */
+ strikethrough?: boolean;
+
+ /**
+ * The color of the text stroke. If unset, the existing
+ * strokeStyle property of the context is unchanged
+ */
+ strokeColor?: Color;
+
+ /**
+ * The text stroke width. If unset, the existing
+ * lineWidth property of the context is unchanged
+ */
+ strokeWidth?: number;
+
+ /**
+ * The text alignment to use. If unset, the existing
+ * textAlign property of the context is unchanged
+ */
+ textAlign: CanvasTextAlign;
+
+ /**
+ * The text baseline to use. If unset, the existing
+ * textBaseline property of the context is unchanged
+ */
+ textBaseline: CanvasTextBaseline;
+
+ /**
+ * If specified, a translation to apply to the context
+ */
+ translation?: [number, number];
+
+ /**
+ * Underline the text
+ */
+ underline?: boolean;
}
export function renderText(
- ctx: CanvasRenderingContext2D,
- text: string | string[],
- x: number,
- y: number,
- font: CanvasFontSpec,
- opts?: RenderTextOpts
+ ctx: CanvasRenderingContext2D,
+ text: string | string[],
+ x: number,
+ y: number,
+ font: CanvasFontSpec,
+ opts?: RenderTextOpts
): void;
export function addRoundedRectPath(ctx: CanvasRenderingContext2D, rect: RoundedRect): void;
export interface ArrayListener<T> {
- _onDataPush?(...item: T[]): void;
- _onDataPop?(): void;
- _onDataShift?(): void;
- _onDataSplice?(index: number, deleteCount: number, ...items: T[]): void;
- _onDataUnshift?(...item: T[]): void;
+ _onDataPush?(...item: T[]): void;
+ _onDataPop?(): void;
+ _onDataShift?(): void;
+ _onDataSplice?(index: number, deleteCount: number, ...items: T[]): void;
+ _onDataUnshift?(...item: T[]): void;
}
/**
export function color(value: CanvasGradient): CanvasGradient;
export function color(value: CanvasPattern): CanvasPattern;
export function color(
- value:
- | string
- | { r: number; g: number; b: number; a: number }
- | [number, number, number]
- | [number, number, number, number]
+ value:
+ | string
+ | { r: number; g: number; b: number; a: number }
+ | [number, number, number]
+ | [number, number, number, number]
): ColorModel;
export interface ColorModel {
- rgbString(): string;
- hexString(): string;
- hslString(): string;
- rgb: { r: number; g: number; b: number; a: number };
- valid: boolean;
- mix(color: ColorModel, weight: number): this;
- clone(): ColorModel;
- alpha(a: number): ColorModel;
- clearer(ration: number): ColorModel;
- greyscale(): ColorModel;
- opaquer(ratio: number): ColorModel;
- negate(): ColorModel;
- lighten(ratio: number): ColorModel;
- darken(ratio: number): ColorModel;
- saturate(ratio: number): ColorModel;
- desaturate(ratio: number): ColorModel;
- rotate(deg: number): this;
+ rgbString(): string;
+ hexString(): string;
+ hslString(): string;
+ rgb: { r: number; g: number; b: number; a: number };
+ valid: boolean;
+ mix(color: ColorModel, weight: number): this;
+ clone(): ColorModel;
+ alpha(a: number): ColorModel;
+ clearer(ration: number): ColorModel;
+ greyscale(): ColorModel;
+ opaquer(ratio: number): ColorModel;
+ negate(): ColorModel;
+ lighten(ratio: number): ColorModel;
+ darken(ratio: number): ColorModel;
+ saturate(ratio: number): ColorModel;
+ desaturate(ratio: number): ColorModel;
+ rotate(deg: number): this;
}
export function getHoverColor(value: CanvasGradient): CanvasGradient;
* @returns {*}
*/
export function callback<T extends (this: TA, ...args: unknown[]) => R, TA, R>(
- fn: T | undefined,
- args: unknown[],
- thisArg?: TA
+ fn: T | undefined,
+ args: unknown[],
+ thisArg?: TA
): R | undefined;
/**
* @param [reverse] - If true, iterates backward on the loopable.
*/
export function each<T, TA>(
- loopable: T[],
- fn: (this: TA, v: T, i: number) => void,
- thisArg?: TA,
- reverse?: boolean
+ loopable: T[],
+ fn: (this: TA, v: T, i: number) => void,
+ thisArg?: TA,
+ reverse?: boolean
): void;
/**
* Note(SB) for performance sake, this method should only be used when loopable type
* @param [reverse] - If true, iterates backward on the loopable.
*/
export function each<T, TA>(
- loopable: { [key: string]: T },
- fn: (this: TA, v: T, k: string) => void,
- thisArg?: TA,
- reverse?: boolean
+ loopable: { [key: string]: T },
+ fn: (this: TA, v: T, k: string) => void,
+ thisArg?: TA,
+ reverse?: boolean
): void;
/**
export function clone<T>(source: T): T;
export interface MergeOptions {
- merger?: (key: string, target: AnyObject, source: AnyObject, options: AnyObject) => AnyObject;
+ merger?: (key: string, target: AnyObject, source: AnyObject, options: AnyObject) => AnyObject;
}
/**
* Recursively deep copies `source` properties into `target` with the given `options`.
export function merge<T, S1, S2>(target: T, source: [S1, S2], options?: MergeOptions): T & S1 & S2;
export function merge<T, S1, S2, S3>(target: T, source: [S1, S2, S3], options?: MergeOptions): T & S1 & S2 & S3;
export function merge<T, S1, S2, S3, S4>(
- target: T,
- source: [S1, S2, S3, S4],
- options?: MergeOptions
+ target: T,
+ source: [S1, S2, S3, S4],
+ options?: MergeOptions
): T & S1 & S2 & S3 & S4;
export function merge<T>(target: T, source: AnyObject[], options?: MergeOptions): AnyObject;
export interface SplinePoint {
- x: number;
- y: number;
+ x: number;
+ y: number;
}
/**
* http://scaledinnovation.com/analytics/splines/aboutSplines.html
*/
export function splineCurve(
- firstPoint: SplinePoint & { skip?: boolean },
- middlePoint: SplinePoint,
- afterPoint: SplinePoint,
- t: number
+ firstPoint: SplinePoint & { skip?: boolean },
+ middlePoint: SplinePoint,
+ afterPoint: SplinePoint,
+ t: number
): {
- previous: SplinePoint;
- next: SplinePoint;
+ previous: SplinePoint;
+ next: SplinePoint;
};
export interface MonotoneSplinePoint extends SplinePoint {
- skip: boolean;
- cp1x?: number;
- cp1y?: number;
- cp2x?: number;
- cp2y?: number;
+ skip: boolean;
+ cp1x?: number;
+ cp1y?: number;
+ cp2x?: number;
+ cp2y?: number;
}
/**
export function getMaximumSize(node: HTMLElement, width?: number, height?: number, aspectRatio?: number): { width: number, height: number };
export function getRelativePosition(
- evt: MouseEvent | ChartEvent,
- chart: { readonly canvas: HTMLCanvasElement }
+ evt: MouseEvent | ChartEvent,
+ chart: { readonly canvas: HTMLCanvasElement }
): { x: number; y: number };
export function getStyle(el: HTMLElement, property: string): string;
export function retinaScale(
- chart: {
- currentDevicePixelRatio: number;
- readonly canvas: HTMLCanvasElement;
- readonly width: number;
- readonly height: number;
- readonly ctx: CanvasRenderingContext2D;
- },
+ chart: {
+ currentDevicePixelRatio: number;
+ readonly canvas: HTMLCanvasElement;
+ readonly width: number;
+ readonly height: number;
+ readonly ctx: CanvasRenderingContext2D;
+ },
forceRatio: number,
forceStyle?: boolean
): void;
* Gets the angle from vertical upright to the point about a centre.
*/
export function getAngleFromPoint(
- centrePoint: { x: number; y: number },
- anglePoint: { x: number; y: number }
+ centrePoint: { x: number; y: number },
+ anglePoint: { x: number; y: number }
): { angle: number; distance: number };
export function distanceBetweenPoints(pt1: { x: number; y: number }, pt2: { x: number; y: number }): number;
import { FontSpec } from '../index.esm';
export interface CanvasFontSpec extends FontSpec {
- string: string;
+ string: string;
}
/**
* Parses font options and returns the font object.
* @since 2.7.0
*/
export function resolve<T, C>(
- inputs: undefined | T | ((c: C) => T) | readonly T[],
- context?: C,
- index?: number,
- info?: { cacheable?: boolean }
+ inputs: undefined | T | ((c: C) => T) | readonly T[],
+ context?: C,
+ index?: number,
+ info?: { cacheable?: boolean }
): T | undefined;
export interface RTLAdapter {
- x(x: number): number;
- setWidth(w: number): void;
- textAlign(align: 'center' | 'left' | 'right'): 'center' | 'left' | 'right';
- xPlus(x: number, value: number): number;
- leftForLtr(x: number, itemWidth: number): number;
+ x(x: number): number;
+ setWidth(w: number): void;
+ textAlign(align: 'center' | 'left' | 'right'): 'center' | 'left' | 'right';
+ xPlus(x: number, value: number): number;
+ leftForLtr(x: number, itemWidth: number): number;
}
export function getRtlAdapter(rtl: boolean, rectX: number, width: number): RTLAdapter;
export interface BarControllerDatasetOptions
extends ControllerDatasetOptions,
- ScriptableAndArrayOptions<BarOptions, ScriptableContext<'bar'>>,
- ScriptableAndArrayOptions<CommonHoverOptions, ScriptableContext<'bar'>>,
- AnimationOptions<'bar'> {
+ ScriptableAndArrayOptions<BarOptions, ScriptableContext<'bar'>>,
+ ScriptableAndArrayOptions<CommonHoverOptions, ScriptableContext<'bar'>>,
+ AnimationOptions<'bar'> {
/**
* The ID of the x axis to plot this dataset on.
*/
export interface BubbleControllerDatasetOptions
extends ControllerDatasetOptions,
- ScriptableAndArrayOptions<PointOptions, ScriptableContext<'bubble'>>,
- ScriptableAndArrayOptions<PointHoverOptions, ScriptableContext<'bubble'>> {}
+ ScriptableAndArrayOptions<PointOptions, ScriptableContext<'bubble'>>,
+ ScriptableAndArrayOptions<PointHoverOptions, ScriptableContext<'bubble'>> {}
export interface BubbleDataPoint {
/**
export interface LineControllerDatasetOptions
extends ControllerDatasetOptions,
- ScriptableAndArrayOptions<PointPrefixedOptions, ScriptableContext<'line'>>,
- ScriptableAndArrayOptions<PointPrefixedHoverOptions, ScriptableContext<'line'>>,
- ScriptableOptions<LineOptions, ScriptableContext<'line'>>,
- ScriptableOptions<LineHoverOptions, ScriptableContext<'line'>>,
- AnimationOptions<'line'> {
+ ScriptableAndArrayOptions<PointPrefixedOptions, ScriptableContext<'line'>>,
+ ScriptableAndArrayOptions<PointPrefixedHoverOptions, ScriptableContext<'line'>>,
+ ScriptableOptions<LineOptions, ScriptableContext<'line'>>,
+ ScriptableOptions<LineHoverOptions, ScriptableContext<'line'>>,
+ AnimationOptions<'line'> {
/**
* The ID of the x axis to plot this dataset on.
*/
export interface DoughnutControllerDatasetOptions
extends ControllerDatasetOptions,
- ScriptableAndArrayOptions<ArcOptions, ScriptableContext<'doughnut'>>,
- ScriptableAndArrayOptions<ArcHoverOptions, ScriptableContext<'doughnut'>>,
- AnimationOptions<'doughnut'> {
+ ScriptableAndArrayOptions<ArcOptions, ScriptableContext<'doughnut'>>,
+ ScriptableAndArrayOptions<ArcHoverOptions, ScriptableContext<'doughnut'>>,
+ AnimationOptions<'doughnut'> {
/**
* Sweep to allow arcs to cover.
export interface RadarControllerDatasetOptions
extends ControllerDatasetOptions,
- ScriptableAndArrayOptions<PointOptions & PointHoverOptions & PointPrefixedOptions & PointPrefixedHoverOptions, ScriptableContext<'radar'>>,
- ScriptableAndArrayOptions<LineOptions & LineHoverOptions, ScriptableContext<'radar'>>,
- AnimationOptions<'radar'> {
- /**
+ ScriptableAndArrayOptions<PointOptions & PointHoverOptions & PointPrefixedOptions & PointPrefixedHoverOptions, ScriptableContext<'radar'>>,
+ ScriptableAndArrayOptions<LineOptions & LineHoverOptions, ScriptableContext<'radar'>>,
+ AnimationOptions<'radar'> {
+ /**
* The ID of the x axis to plot this dataset on.
*/
xAxisID: string;
// When this was introduced, doing so was a breaking change
TType extends ChartType = ChartType,
> = DeepPartial<
- { [key in ChartType]: ChartTypeRegistry[key]['metaExtensions'] }[TType]
+{ [key in ChartType]: ChartTypeRegistry[key]['metaExtensions'] }[TType]
> & ChartMetaCommon<TElement, TDatasetElement>;
export interface ActiveDataPoint {
TType extends ChartType = ChartType,
TData = DefaultDataPoint<TType>,
TLabel = unknown
- > {
+> {
readonly platform: BasePlatform;
readonly id: string;
readonly canvas: HTMLCanvasElement;
export type Overrides = {
[key in ChartType]:
- CoreChartOptions<key> &
- ElementChartOptions<key> &
- PluginChartOptions<key> &
- DatasetChartOptions<ChartType> &
- ScaleChartOptions<key> &
- ChartTypeRegistry[key]['chartOptions'];
+ CoreChartOptions<key> &
+ ElementChartOptions<key> &
+ PluginChartOptions<key> &
+ DatasetChartOptions<ChartType> &
+ ScaleChartOptions<key> &
+ ChartTypeRegistry[key]['chartOptions'];
}
export const defaults: Defaults;
export interface ChartEvent {
type:
- | 'contextmenu'
- | 'mouseenter'
- | 'mousedown'
- | 'mousemove'
- | 'mouseup'
- | 'mouseout'
- | 'click'
- | 'dblclick'
- | 'keydown'
- | 'keypress'
- | 'keyup'
- | 'resize';
+ | 'contextmenu'
+ | 'mouseenter'
+ | 'mousedown'
+ | 'mousemove'
+ | 'mouseup'
+ | 'mouseout'
+ | 'click'
+ | 'dblclick'
+ | 'keydown'
+ | 'keypress'
+ | 'keyup'
+ | 'resize';
native: Event | null;
x: number | null;
y: number | null;
export interface ArcElement<T extends ArcProps = ArcProps, O extends ArcOptions = ArcOptions>
extends Element<T, O>,
- VisualElement {}
+ VisualElement {}
export const ArcElement: ChartComponent & {
prototype: ArcElement;
export interface LineElement<T extends LineProps = LineProps, O extends LineOptions = LineOptions>
extends Element<T, O>,
- VisualElement {
+ VisualElement {
updateControlPoints(chartArea: ChartArea, indexAxis?: 'x' | 'y'): void;
points: Point[];
readonly segments: Segment[];
export interface PointElement<T extends PointProps = PointProps, O extends PointOptions = PointOptions>
extends Element<T, O>,
- VisualElement {
+ VisualElement {
readonly skip: boolean;
readonly parsed: CartesianParsedData;
}
};
export type ChartOptions<TType extends ChartType = ChartType> = DeepPartial<
- CoreChartOptions<TType> &
- ElementChartOptions<TType> &
- PluginChartOptions<TType> &
- DatasetChartOptions<TType> &
- ScaleChartOptions<TType> &
- ChartTypeRegistry[TType]['chartOptions']
+CoreChartOptions<TType> &
+ElementChartOptions<TType> &
+PluginChartOptions<TType> &
+DatasetChartOptions<TType> &
+ScaleChartOptions<TType> &
+ChartTypeRegistry[TType]['chartOptions']
>;
export type DefaultDataPoint<TType extends ChartType> = DistributiveArray<ChartTypeRegistry[TType]['defaultDataPoint']>;
TType extends ChartType = ChartType,
TData = DefaultDataPoint<TType>
> = DeepPartial<
- { [key in ChartType]: { type: key } & ChartTypeRegistry[key]['datasetOptions'] }[TType]
+{ [key in ChartType]: { type: key } & ChartTypeRegistry[key]['datasetOptions'] }[TType]
> & ChartDatasetProperties<TType, TData>;
export interface ChartData<
export type LayoutPosition = 'left' | 'top' | 'right' | 'bottom' | 'center' | 'chartArea' | {[scaleId: string]: number};
export interface LayoutItem {
- /**
- * The position of the item in the chart layout. Possible values are
- */
- position: LayoutPosition;
- /**
- * The weight used to sort the item. Higher weights are further away from the chart area
- */
- weight: number;
- /**
- * if true, and the item is horizontal, then push vertical boxes down
- */
- fullSize: boolean;
- /**
- * Width of item. Must be valid after update()
- */
- width: number;
- /**
- * Height of item. Must be valid after update()
- */
- height: number;
- /**
- * Left edge of the item. Set by layout system and cannot be used in update
- */
- left: number;
- /**
- * Top edge of the item. Set by layout system and cannot be used in update
- */
- top: number;
- /**
- * Right edge of the item. Set by layout system and cannot be used in update
- */
- right: number;
- /**
- * Bottom edge of the item. Set by layout system and cannot be used in update
- */
- bottom: number;
+ /**
+ * The position of the item in the chart layout. Possible values are
+ */
+ position: LayoutPosition;
+ /**
+ * The weight used to sort the item. Higher weights are further away from the chart area
+ */
+ weight: number;
+ /**
+ * if true, and the item is horizontal, then push vertical boxes down
+ */
+ fullSize: boolean;
+ /**
+ * Width of item. Must be valid after update()
+ */
+ width: number;
+ /**
+ * Height of item. Must be valid after update()
+ */
+ height: number;
+ /**
+ * Left edge of the item. Set by layout system and cannot be used in update
+ */
+ left: number;
+ /**
+ * Top edge of the item. Set by layout system and cannot be used in update
+ */
+ top: number;
+ /**
+ * Right edge of the item. Set by layout system and cannot be used in update
+ */
+ right: number;
+ /**
+ * Bottom edge of the item. Set by layout system and cannot be used in update
+ */
+ bottom: number;
- /**
- * Called before the layout process starts
- */
- beforeLayout?(): void;
- /**
- * Draws the element
- */
- draw(chartArea: ChartArea): void;
- /**
- * Returns an object with padding on the edges
- */
- getPadding?(): ChartArea;
- /**
- * returns true if the layout item is horizontal (ie. top or bottom)
- */
- isHorizontal(): boolean;
- /**
- * Takes two parameters: width and height.
- * @param width
- * @param height
- */
- update(width: number, height: number, margins?: ChartArea): void;
+ /**
+ * Called before the layout process starts
+ */
+ beforeLayout?(): void;
+ /**
+ * Draws the element
+ */
+ draw(chartArea: ChartArea): void;
+ /**
+ * Returns an object with padding on the edges
+ */
+ getPadding?(): ChartArea;
+ /**
+ * returns true if the layout item is horizontal (ie. top or bottom)
+ */
+ isHorizontal(): boolean;
+ /**
+ * Takes two parameters: width and height.
+ * @param width
+ * @param height
+ */
+ update(width: number, height: number, margins?: ChartArea): void;
}
export type DeepPartial<T> = T extends Function
? T
: T extends Array<infer U>
- ? _DeepPartialArray<U>
- : T extends object
- ? _DeepPartialObject<T>
- : T | undefined;
+ ? _DeepPartialArray<U>
+ : T extends object
+ ? _DeepPartialObject<T>
+ : T | undefined;
type _DeepPartialArray<T> = Array<DeepPartial<T>>
type _DeepPartialObject<T> = { [P in keyof T]?: DeepPartial<T[P]> };