/** * @sgratzl/chartjs-chart-boxplot * https://github.com/sgratzl/chartjs-chart-boxplot * * Copyright (c) 2019-2022 Samuel Gratzl */ import { Element, ChartType, ScriptableAndArrayOptions, CommonHoverOptions, ScriptableContext, BarController, CartesianScaleTypeRegistry, ControllerDatasetOptions, AnimationOptions, Chart, ChartItem, ChartConfiguration, TooltipModel } from 'chart.js'; interface IStatsBaseOptions { backgroundColor: string; borderColor: string; borderWidth: number; outlierStyle: 'circle' | 'triangle' | 'rect' | 'rectRounded' | 'rectRot' | 'cross' | 'crossRot' | 'star' | 'line' | 'dash'; outlierRadius: number; outlierBackgroundColor: string; outlierBorderColor: string; outlierBorderWidth: number; itemStyle: 'circle' | 'triangle' | 'rect' | 'rectRounded' | 'rectRot' | 'cross' | 'crossRot' | 'star' | 'line' | 'dash'; itemRadius: number; itemBackgroundColor: string; itemBorderColor: string; itemBorderWidth: number; hitPadding: number; outlierHitRadius: number; meanStyle: 'circle' | 'triangle' | 'rect' | 'rectRounded' | 'rectRot' | 'cross' | 'crossRot' | 'star' | 'line' | 'dash'; meanRadius: number; meanBackgroundColor: string; meanBorderColor: string; meanBorderWidth: number; } interface IStatsBaseProps { x: number; y: number; width: number; height: number; items: number[]; outliers: number[]; } declare class StatsBase$1 extends Element { } interface IBoxAndWhiskersOptions extends IStatsBaseOptions { medianColor: string; lowerBackgroundColor: string; } interface IBoxAndWhiskerProps extends IStatsBaseProps { q1: number; q3: number; median: number; whiskerMin: number; whiskerMax: number; mean: number; } declare class BoxAndWiskers extends StatsBase$1 { } declare module 'chart.js' { interface ElementOptionsByType { boxplot: ScriptableAndArrayOptions>; } } interface IBaseStats { min: number; max: number; q1: number; q3: number; median: number; mean: number; items: readonly number[]; outliers: readonly number[]; } interface IBoxPlot extends IBaseStats { whiskerMax: number; whiskerMin: number; } interface IKDEPoint { v: number; estimate: number; } interface IViolin extends IBaseStats { maxEstimate: number; coords: IKDEPoint[]; } type QuantileMethod = 7 | 'quantiles' | 'hinges' | 'fivenum' | 'linear' | 'lower' | 'higher' | 'nearest' | 'midpoint' | ((arr: ArrayLike, length?: number | undefined) => { q1: number; median: number; q3: number; }); interface IBaseOptions { minStats?: 'min' | 'q1' | 'whiskerMin'; maxStats?: 'max' | 'q3' | 'whiskerMax'; coef?: number; quantiles?: QuantileMethod; } type IBoxplotOptions = IBaseOptions; interface IViolinOptions extends IBaseOptions { points: number; } type IViolinElementOptions = IStatsBaseOptions; interface IViolinElementProps extends IStatsBaseProps { min: number; max: number; median: number; coords: IKDEPoint[]; maxEstimate?: number; } declare class Violin extends StatsBase$1 { } declare module 'chart.js' { interface ElementOptionsByType { violin: ScriptableAndArrayOptions>; } } declare abstract class StatsBase> extends BarController { } declare class BoxPlotController extends StatsBase> { } interface BoxPlotControllerDatasetOptions extends ControllerDatasetOptions, IBoxplotOptions, ScriptableAndArrayOptions>, ScriptableAndArrayOptions>, AnimationOptions<'boxplot'> { } type BoxPlotDataPoint = number[] | (Partial & Pick); interface IBoxPlotChartOptions extends IBoxplotOptions { } declare module 'chart.js' { interface ChartTypeRegistry { boxplot: { chartOptions: IBoxPlotChartOptions; datasetOptions: BoxPlotControllerDatasetOptions; defaultDataPoint: BoxPlotDataPoint; scales: keyof CartesianScaleTypeRegistry; metaExtensions: {}; parsedDataType: IBoxPlot & ChartTypeRegistry['bar']['parsedDataType']; }; } } declare class BoxPlotChart extends Chart<'boxplot', DATA, LABEL> { constructor(item: ChartItem, config: Omit, 'type'>); } declare class ViolinController extends StatsBase> { } type ViolinDataPoint = number[] | (Partial & Pick); interface ViolinControllerDatasetOptions extends ControllerDatasetOptions, IViolinOptions, ScriptableAndArrayOptions>, ScriptableAndArrayOptions>, AnimationOptions<'violin'> { } interface IViolinChartOptions extends IViolinOptions { } declare module 'chart.js' { interface ChartTypeRegistry { violin: { chartOptions: IViolinChartOptions; datasetOptions: ViolinControllerDatasetOptions; defaultDataPoint: ViolinDataPoint; scales: keyof CartesianScaleTypeRegistry; metaExtensions: {}; parsedDataType: IViolin & ChartTypeRegistry['bar']['parsedDataType']; }; } } declare class ViolinChart extends Chart<'violin', DATA, LABEL> { static id: string; constructor(item: ChartItem, config: Omit, 'type'>); } interface ExtendedTooltip extends TooltipModel<'boxplot' | 'violin'> { _tooltipOutlier?: { index: number; datasetIndex: number; }; } export { BoxAndWiskers, BoxPlotChart, BoxPlotController, BoxPlotControllerDatasetOptions, BoxPlotDataPoint, ExtendedTooltip, IBaseOptions, IBaseStats, IBoxAndWhiskerProps, IBoxAndWhiskersOptions, IBoxPlot, IBoxPlotChartOptions, IBoxplotOptions, IKDEPoint, IStatsBaseOptions, IStatsBaseProps, IViolin, IViolinChartOptions, IViolinElementOptions, IViolinElementProps, IViolinOptions, QuantileMethod, StatsBase$1 as StatsBase, Violin, ViolinChart, ViolinController, ViolinControllerDatasetOptions, ViolinDataPoint }; //# sourceMappingURL=index.d.ts.map