}
export interface Chart<
- T = number,
+ T = unknown,
L = string,
C extends IChartConfiguration<string, T, L> = IChartConfiguration<string, T, L>
> {
readonly width: number;
readonly height: number;
readonly aspectRatio: number;
- readonly options: ConfigurationOptions<C>;
readonly boxes: ILayoutItem[];
readonly currentDevicePixelRatio: number;
readonly chartArea: IChartArea;
readonly scale: Scale | undefined;
readonly attached: boolean;
+ options: ConfigurationOptions<C>;
+
clear(): this;
stop(): this;
export const Chart: {
prototype: Chart;
- new <T = number, L = string, C extends IChartConfiguration<string, T, L> = IChartConfiguration<string, T, L>>(
+ new <T = unknown, L = string, C extends IChartConfiguration<string, T, L> = IChartConfiguration<string, T, L>>(
item: ChartItem,
config: C
): Chart<T, L, C>;
}
: T;
-export type IChartDataset<T = number, O = {}> = DeepPartial<IControllerDatasetOptions & IParsingOptions & O> & {
+export type IChartDataset<T = unknown, O = {}> = DeepPartial<IControllerDatasetOptions & IParsingOptions & O> & {
data: T[];
};
export type IPolarAreaControllerDataset<T = number> = IChartDataset<T, IPolarAreaControllerDatasetOptions>;
export type IRadarControllerDataset<T = number> = IChartDataset<T, IRadarControllerDatasetOptions>;
-export interface IChartData<T = number, L = string, DS extends IChartDataset<T> = IChartDataset<T>>
+export interface IChartData<T = unknown, L = string, DS extends IChartDataset<T> = IChartDataset<T>>
extends DeepPartial<IParsingOptions> {
labels: L[];
datasets: DS[];
export type IChartOptions<O = {}> = DeepPartial<
ICoreChartOptions &
+ IParsingOptions &
ITooltipChartOptions &
ILegendChartOptions &
ITitleChartOptions &
export interface IChartConfiguration<
TYPE = string,
- T = number,
+ T = unknown,
L = string,
DS extends IChartDataset<T> = IChartDataset<T>,
O = {}
import { Chart, Element, IAnimationSpecContainer, InteractionMode, LayoutPosition, IPlugin } from '../core';
-import { Color, IChartArea, IFontSpec, Scriptable, TextAlign, IEvent } from '../core/interfaces';
+import { Color, IChartArea, IFontSpec, Scriptable, TextAlign, IEvent, IHoverInteractionOptions } from '../core/interfaces';
import { PointStyle } from '../elements';
-import { IChartData } from '../interfaces';
+import { IChartData, IChartDataset } from '../interfaces';
export const Filler: IPlugin;
afterTooltipDraw?(chart: Chart, args: { tooltip: TooltipModel }, options: O): void;
}
-export interface ITooltipOptions {
+export interface ITooltipOptions extends IHoverInteractionOptions {
/**
* Are on-canvas tooltips enabled?
* @default true
* See custom tooltip section.
*/
custom(this: TooltipModel, args: { chart: Chart; tooltip: TooltipModel }): void;
- /**
- * Sets which elements appear in the tooltip.
- */
- mode: InteractionMode;
/**
* The mode for positioning the tooltip
*/
position: 'average' | 'nearest';
- /**
- * If true, the tooltip mode applies only when the mouse position intersects with an element. If false, the mode will be applied at all times.
- */
- intersect: boolean;
/**
* Sort tooltip items.
/**
* The dataset the item comes from
*/
- dataset: object;
+ dataset: IChartDataset;
/**
* Index of the dataset the item comes from
new <O extends ICategoryScaleOptions = ICategoryScaleOptions>(cfg: any): CategoryScale<O>;
};
-export type ILinearScaleOptions = IScaleOptions & {
+export type ILinearScaleOptions = ICartesianScaleOptions & {
stacked?: boolean;
/**
*/
isoWeekday: false | string;
/**
- * Sets how different time units are displayed.
+ * Sets how different time units are displayed.
* @see https://www.chartjs.org/docs/next/axes/cartesian/time#display-formats
*/
displayFormats: {
[key: string]: string;
};
+ /**
+ * The format string to use for the tooltip.
+ */
+ tooltipFormat: string;
/**
* If defined, will force the unit to be a certain type. See Time Units section below for details.
* @default false