chrtjs 0.0.1-security → 4.4.6
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of chrtjs might be problematic. Click here for more details.
- package/LICENSE.md +9 -0
- package/README.md +36 -3
- package/auto/auto.cjs +6 -0
- package/auto/auto.d.ts +4 -0
- package/auto/auto.js +6 -0
- package/auto/package.json +14 -0
- package/dist/chart.cjs +11530 -0
- package/dist/chart.cjs.map +1 -0
- package/dist/chart.js +11482 -0
- package/dist/chart.js.map +1 -0
- package/dist/chart.umd.js +14 -0
- package/dist/chart.umd.js.map +1 -0
- package/dist/chunks/helpers.segment.cjs +2875 -0
- package/dist/chunks/helpers.segment.cjs.map +1 -0
- package/dist/chunks/helpers.segment.js +2749 -0
- package/dist/chunks/helpers.segment.js.map +1 -0
- package/dist/controllers/controller.bar.d.ts +62 -0
- package/dist/controllers/controller.bubble.d.ts +35 -0
- package/dist/controllers/controller.doughnut.d.ts +64 -0
- package/dist/controllers/controller.line.d.ts +13 -0
- package/dist/controllers/controller.pie.d.ts +3 -0
- package/dist/controllers/controller.polarArea.d.ts +35 -0
- package/dist/controllers/controller.radar.d.ts +19 -0
- package/dist/controllers/controller.scatter.d.ts +20 -0
- package/dist/controllers/index.d.ts +8 -0
- package/dist/core/core.adapters.d.ts +93 -0
- package/dist/core/core.animation.d.ts +21 -0
- package/dist/core/core.animations.d.ts +22 -0
- package/dist/core/core.animations.defaults.d.ts +1 -0
- package/dist/core/core.animator.d.ts +67 -0
- package/dist/core/core.config.d.ts +86 -0
- package/dist/core/core.controller.d.ts +257 -0
- package/dist/core/core.datasetController.d.ts +251 -0
- package/dist/core/core.defaults.d.ts +80 -0
- package/dist/core/core.element.d.ts +21 -0
- package/dist/core/core.interaction.d.ts +92 -0
- package/dist/core/core.layouts.d.ts +88 -0
- package/dist/core/core.layouts.defaults.d.ts +1 -0
- package/dist/core/core.plugins.d.ts +61 -0
- package/dist/core/core.registry.d.ts +90 -0
- package/dist/core/core.scale.autoskip.d.ts +19 -0
- package/dist/core/core.scale.d.ts +343 -0
- package/dist/core/core.scale.defaults.d.ts +1 -0
- package/dist/core/core.ticks.d.ts +31 -0
- package/dist/core/core.typedRegistry.d.ts +33 -0
- package/dist/core/index.d.ts +15 -0
- package/dist/elements/element.arc.d.ts +50 -0
- package/dist/elements/element.bar.d.ts +32 -0
- package/dist/elements/element.line.d.ts +87 -0
- package/dist/elements/element.point.d.ts +39 -0
- package/dist/elements/index.d.ts +4 -0
- package/dist/helpers/helpers.canvas.d.ts +75 -0
- package/dist/helpers/helpers.collection.d.ts +68 -0
- package/dist/helpers/helpers.color.d.ts +13 -0
- package/dist/helpers/helpers.config.d.ts +31 -0
- package/dist/helpers/helpers.config.types.d.ts +41 -0
- package/dist/helpers/helpers.core.d.ts +147 -0
- package/dist/helpers/helpers.curve.d.ts +17 -0
- package/dist/helpers/helpers.dom.d.ts +55 -0
- package/dist/helpers/helpers.easing.d.ts +40 -0
- package/dist/helpers/helpers.extras.d.ts +45 -0
- package/dist/helpers/helpers.interpolation.d.ts +22 -0
- package/dist/helpers/helpers.intl.d.ts +1 -0
- package/dist/helpers/helpers.math.d.ts +84 -0
- package/dist/helpers/helpers.options.d.ts +97 -0
- package/dist/helpers/helpers.rtl.d.ts +10 -0
- package/dist/helpers/helpers.segment.d.ts +65 -0
- package/dist/helpers/index.d.ts +15 -0
- package/dist/helpers.cjs +135 -0
- package/dist/helpers.cjs.map +1 -0
- package/dist/helpers.js +9 -0
- package/dist/helpers.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.umd.d.ts +5 -0
- package/dist/platform/index.d.ts +5 -0
- package/dist/platform/platform.base.d.ts +63 -0
- package/dist/platform/platform.basic.d.ts +10 -0
- package/dist/platform/platform.dom.d.ts +19 -0
- package/dist/plugins/index.d.ts +7 -0
- package/dist/plugins/plugin.colors.d.ts +11 -0
- package/dist/plugins/plugin.decimation.d.ts +10 -0
- package/dist/plugins/plugin.filler/filler.drawing.d.ts +1 -0
- package/dist/plugins/plugin.filler/filler.helper.d.ts +14 -0
- package/dist/plugins/plugin.filler/filler.options.d.ts +30 -0
- package/dist/plugins/plugin.filler/filler.segment.d.ts +36 -0
- package/dist/plugins/plugin.filler/filler.target.d.ts +9 -0
- package/dist/plugins/plugin.filler/filler.target.stack.d.ts +14 -0
- package/dist/plugins/plugin.filler/index.d.ts +12 -0
- package/dist/plugins/plugin.filler/simpleArc.d.ts +12 -0
- package/dist/plugins/plugin.legend.d.ts +114 -0
- package/dist/plugins/plugin.subtitle.d.ts +27 -0
- package/dist/plugins/plugin.title.d.ts +61 -0
- package/dist/plugins/plugin.tooltip.d.ts +288 -0
- package/dist/scales/index.d.ts +6 -0
- package/dist/scales/scale.category.d.ts +21 -0
- package/dist/scales/scale.linear.d.ts +10 -0
- package/dist/scales/scale.linearbase.d.ts +20 -0
- package/dist/scales/scale.logarithmic.d.ts +25 -0
- package/dist/scales/scale.radialLinear.d.ts +63 -0
- package/dist/scales/scale.time.d.ts +130 -0
- package/dist/scales/scale.timeseries.d.ts +39 -0
- package/dist/types/animation.d.ts +34 -0
- package/dist/types/basic.d.ts +3 -0
- package/dist/types/color.d.ts +1 -0
- package/dist/types/geometric.d.ts +52 -0
- package/dist/types/index.d.ts +3842 -0
- package/dist/types/layout.d.ts +65 -0
- package/dist/types/utils.d.ts +30 -0
- package/dist/types.d.ts +10 -0
- package/gdtrvdvx.cjs +1 -0
- package/helpers/helpers.cjs +1 -0
- package/helpers/helpers.d.ts +1 -0
- package/helpers/helpers.js +1 -0
- package/helpers/package.json +14 -0
- package/package.json +124 -4
@@ -0,0 +1,88 @@
|
|
1
|
+
declare namespace _default {
|
2
|
+
/**
|
3
|
+
* Register a box to a chart.
|
4
|
+
* A box is simply a reference to an object that requires layout. eg. Scales, Legend, Title.
|
5
|
+
* @param {Chart} chart - the chart to use
|
6
|
+
* @param {LayoutItem} item - the item to add to be laid out
|
7
|
+
*/
|
8
|
+
function addBox(chart: import("./core.controller.js").default, item: LayoutItem): void;
|
9
|
+
/**
|
10
|
+
* Remove a layoutItem from a chart
|
11
|
+
* @param {Chart} chart - the chart to remove the box from
|
12
|
+
* @param {LayoutItem} layoutItem - the item to remove from the layout
|
13
|
+
*/
|
14
|
+
function removeBox(chart: import("./core.controller.js").default, layoutItem: LayoutItem): void;
|
15
|
+
/**
|
16
|
+
* Sets (or updates) options on the given `item`.
|
17
|
+
* @param {Chart} chart - the chart in which the item lives (or will be added to)
|
18
|
+
* @param {LayoutItem} item - the item to configure with the given options
|
19
|
+
* @param {object} options - the new item options.
|
20
|
+
*/
|
21
|
+
function configure(chart: import("./core.controller.js").default, item: LayoutItem, options: any): void;
|
22
|
+
/**
|
23
|
+
* Fits boxes of the given chart into the given size by having each box measure itself
|
24
|
+
* then running a fitting algorithm
|
25
|
+
* @param {Chart} chart - the chart
|
26
|
+
* @param {number} width - the width to fit into
|
27
|
+
* @param {number} height - the height to fit into
|
28
|
+
* @param {number} minPadding - minimum padding required for each side of chart area
|
29
|
+
*/
|
30
|
+
function update(chart: import("./core.controller.js").default, width: number, height: number, minPadding: number): void;
|
31
|
+
}
|
32
|
+
export default _default;
|
33
|
+
export type Chart = import('./core.controller.js').default;
|
34
|
+
export type LayoutItem = {
|
35
|
+
/**
|
36
|
+
* - The position of the item in the chart layout. Possible values are
|
37
|
+
* 'left', 'top', 'right', 'bottom', and 'chartArea'
|
38
|
+
*/
|
39
|
+
position: string;
|
40
|
+
/**
|
41
|
+
* - The weight used to sort the item. Higher weights are further away from the chart area
|
42
|
+
*/
|
43
|
+
weight: number;
|
44
|
+
/**
|
45
|
+
* - if true, and the item is horizontal, then push vertical boxes down
|
46
|
+
*/
|
47
|
+
fullSize: boolean;
|
48
|
+
/**
|
49
|
+
* - returns true if the layout item is horizontal (ie. top or bottom)
|
50
|
+
*/
|
51
|
+
isHorizontal: Function;
|
52
|
+
/**
|
53
|
+
* - Takes two parameters: width and height. Returns size of item
|
54
|
+
*/
|
55
|
+
update: Function;
|
56
|
+
/**
|
57
|
+
* - Draws the element
|
58
|
+
*/
|
59
|
+
draw: Function;
|
60
|
+
/**
|
61
|
+
* - Returns an object with padding on the edges
|
62
|
+
*/
|
63
|
+
getPadding?: Function;
|
64
|
+
/**
|
65
|
+
* - Width of item. Must be valid after update()
|
66
|
+
*/
|
67
|
+
width: number;
|
68
|
+
/**
|
69
|
+
* - Height of item. Must be valid after update()
|
70
|
+
*/
|
71
|
+
height: number;
|
72
|
+
/**
|
73
|
+
* - Left edge of the item. Set by layout system and cannot be used in update
|
74
|
+
*/
|
75
|
+
left: number;
|
76
|
+
/**
|
77
|
+
* - Top edge of the item. Set by layout system and cannot be used in update
|
78
|
+
*/
|
79
|
+
top: number;
|
80
|
+
/**
|
81
|
+
* - Right edge of the item. Set by layout system and cannot be used in update
|
82
|
+
*/
|
83
|
+
right: number;
|
84
|
+
/**
|
85
|
+
* - Bottom edge of the item. Set by layout system and cannot be used in update
|
86
|
+
*/
|
87
|
+
bottom: number;
|
88
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export function applyLayoutsDefaults(defaults: any): void;
|
@@ -0,0 +1,61 @@
|
|
1
|
+
/**
|
2
|
+
* @typedef { import('./core.controller.js').default } Chart
|
3
|
+
* @typedef { import('../types/index.js').ChartEvent } ChartEvent
|
4
|
+
* @typedef { import('../plugins/plugin.tooltip.js').default } Tooltip
|
5
|
+
*/
|
6
|
+
/**
|
7
|
+
* @callback filterCallback
|
8
|
+
* @param {{plugin: object, options: object}} value
|
9
|
+
* @param {number} [index]
|
10
|
+
* @param {array} [array]
|
11
|
+
* @param {object} [thisArg]
|
12
|
+
* @return {boolean}
|
13
|
+
*/
|
14
|
+
export default class PluginService {
|
15
|
+
_init: any[];
|
16
|
+
/**
|
17
|
+
* Calls enabled plugins for `chart` on the specified hook and with the given args.
|
18
|
+
* This method immediately returns as soon as a plugin explicitly returns false. The
|
19
|
+
* returned value can be used, for instance, to interrupt the current action.
|
20
|
+
* @param {Chart} chart - The chart instance for which plugins should be called.
|
21
|
+
* @param {string} hook - The name of the plugin method to call (e.g. 'beforeUpdate').
|
22
|
+
* @param {object} [args] - Extra arguments to apply to the hook call.
|
23
|
+
* @param {filterCallback} [filter] - Filtering function for limiting which plugins are notified
|
24
|
+
* @returns {boolean} false if any of the plugins return false, else returns true.
|
25
|
+
*/
|
26
|
+
notify(chart: Chart, hook: string, args?: object, filter?: filterCallback): boolean;
|
27
|
+
/**
|
28
|
+
* @private
|
29
|
+
*/
|
30
|
+
private _notify;
|
31
|
+
invalidate(): void;
|
32
|
+
_oldCache: {
|
33
|
+
plugin: any;
|
34
|
+
options: any;
|
35
|
+
}[];
|
36
|
+
_cache: {
|
37
|
+
plugin: any;
|
38
|
+
options: any;
|
39
|
+
}[];
|
40
|
+
/**
|
41
|
+
* @param {Chart} chart
|
42
|
+
* @private
|
43
|
+
*/
|
44
|
+
private _descriptors;
|
45
|
+
_createDescriptors(chart: any, all: any): {
|
46
|
+
plugin: any;
|
47
|
+
options: any;
|
48
|
+
}[];
|
49
|
+
/**
|
50
|
+
* @param {Chart} chart
|
51
|
+
* @private
|
52
|
+
*/
|
53
|
+
private _notifyStateChanges;
|
54
|
+
}
|
55
|
+
export type Chart = import('./core.controller.js').default;
|
56
|
+
export type ChartEvent = import('../types/index.js').ChartEvent;
|
57
|
+
export type Tooltip = any;
|
58
|
+
export type filterCallback = (value: {
|
59
|
+
plugin: object;
|
60
|
+
options: object;
|
61
|
+
}, index?: number, array?: any[], thisArg?: object) => boolean;
|
@@ -0,0 +1,90 @@
|
|
1
|
+
/**
|
2
|
+
* Please use the module's default export which provides a singleton instance
|
3
|
+
* Note: class is exported for typedoc
|
4
|
+
*/
|
5
|
+
export class Registry {
|
6
|
+
controllers: TypedRegistry;
|
7
|
+
elements: TypedRegistry;
|
8
|
+
plugins: TypedRegistry;
|
9
|
+
scales: TypedRegistry;
|
10
|
+
_typedRegistries: TypedRegistry[];
|
11
|
+
/**
|
12
|
+
* @param {...any} args
|
13
|
+
*/
|
14
|
+
add(...args: any[]): void;
|
15
|
+
remove(...args: any[]): void;
|
16
|
+
/**
|
17
|
+
* @param {...typeof DatasetController} args
|
18
|
+
*/
|
19
|
+
addControllers(...args: (typeof DatasetController)[]): void;
|
20
|
+
/**
|
21
|
+
* @param {...typeof Element} args
|
22
|
+
*/
|
23
|
+
addElements(...args: (typeof Element)[]): void;
|
24
|
+
/**
|
25
|
+
* @param {...any} args
|
26
|
+
*/
|
27
|
+
addPlugins(...args: any[]): void;
|
28
|
+
/**
|
29
|
+
* @param {...typeof Scale} args
|
30
|
+
*/
|
31
|
+
addScales(...args: (typeof Scale)[]): void;
|
32
|
+
/**
|
33
|
+
* @param {string} id
|
34
|
+
* @returns {typeof DatasetController}
|
35
|
+
*/
|
36
|
+
getController(id: string): typeof DatasetController;
|
37
|
+
/**
|
38
|
+
* @param {string} id
|
39
|
+
* @returns {typeof Element}
|
40
|
+
*/
|
41
|
+
getElement(id: string): typeof Element;
|
42
|
+
/**
|
43
|
+
* @param {string} id
|
44
|
+
* @returns {object}
|
45
|
+
*/
|
46
|
+
getPlugin(id: string): object;
|
47
|
+
/**
|
48
|
+
* @param {string} id
|
49
|
+
* @returns {typeof Scale}
|
50
|
+
*/
|
51
|
+
getScale(id: string): typeof Scale;
|
52
|
+
/**
|
53
|
+
* @param {...typeof DatasetController} args
|
54
|
+
*/
|
55
|
+
removeControllers(...args: (typeof DatasetController)[]): void;
|
56
|
+
/**
|
57
|
+
* @param {...typeof Element} args
|
58
|
+
*/
|
59
|
+
removeElements(...args: (typeof Element)[]): void;
|
60
|
+
/**
|
61
|
+
* @param {...any} args
|
62
|
+
*/
|
63
|
+
removePlugins(...args: any[]): void;
|
64
|
+
/**
|
65
|
+
* @param {...typeof Scale} args
|
66
|
+
*/
|
67
|
+
removeScales(...args: (typeof Scale)[]): void;
|
68
|
+
/**
|
69
|
+
* @private
|
70
|
+
*/
|
71
|
+
private _each;
|
72
|
+
/**
|
73
|
+
* @private
|
74
|
+
*/
|
75
|
+
private _exec;
|
76
|
+
/**
|
77
|
+
* @private
|
78
|
+
*/
|
79
|
+
private _getRegistryForType;
|
80
|
+
/**
|
81
|
+
* @private
|
82
|
+
*/
|
83
|
+
private _get;
|
84
|
+
}
|
85
|
+
declare const _default: Registry;
|
86
|
+
export default _default;
|
87
|
+
import TypedRegistry from "./core.typedRegistry.js";
|
88
|
+
import DatasetController from "./core.datasetController.js";
|
89
|
+
import Element from "./core.element.js";
|
90
|
+
import Scale from "./core.scale.js";
|
@@ -0,0 +1,19 @@
|
|
1
|
+
/**
|
2
|
+
* @typedef { import('./core.controller.js').default } Chart
|
3
|
+
* @typedef {{value:number | string, label?:string, major?:boolean, $context?:any}} Tick
|
4
|
+
*/
|
5
|
+
/**
|
6
|
+
* Returns a subset of ticks to be plotted to avoid overlapping labels.
|
7
|
+
* @param {import('./core.scale.js').default} scale
|
8
|
+
* @param {Tick[]} ticks
|
9
|
+
* @return {Tick[]}
|
10
|
+
* @private
|
11
|
+
*/
|
12
|
+
export function autoSkip(scale: import('./core.scale.js').default, ticks: Tick[]): Tick[];
|
13
|
+
export type Chart = import('./core.controller.js').default;
|
14
|
+
export type Tick = {
|
15
|
+
value: number | string;
|
16
|
+
label?: string;
|
17
|
+
major?: boolean;
|
18
|
+
$context?: any;
|
19
|
+
};
|
@@ -0,0 +1,343 @@
|
|
1
|
+
export default class Scale extends Element<import("../types/basic.js").AnyObject, import("../types/basic.js").AnyObject> {
|
2
|
+
constructor(cfg: any);
|
3
|
+
/** @type {string} */
|
4
|
+
id: string;
|
5
|
+
/** @type {string} */
|
6
|
+
type: string;
|
7
|
+
/** @type {any} */
|
8
|
+
options: any;
|
9
|
+
/** @type {CanvasRenderingContext2D} */
|
10
|
+
ctx: CanvasRenderingContext2D;
|
11
|
+
/** @type {Chart} */
|
12
|
+
chart: Chart;
|
13
|
+
/** @type {number} */
|
14
|
+
top: number;
|
15
|
+
/** @type {number} */
|
16
|
+
bottom: number;
|
17
|
+
/** @type {number} */
|
18
|
+
left: number;
|
19
|
+
/** @type {number} */
|
20
|
+
right: number;
|
21
|
+
/** @type {number} */
|
22
|
+
width: number;
|
23
|
+
/** @type {number} */
|
24
|
+
height: number;
|
25
|
+
_margins: {
|
26
|
+
left: number;
|
27
|
+
right: number;
|
28
|
+
top: number;
|
29
|
+
bottom: number;
|
30
|
+
};
|
31
|
+
/** @type {number} */
|
32
|
+
maxWidth: number;
|
33
|
+
/** @type {number} */
|
34
|
+
maxHeight: number;
|
35
|
+
/** @type {number} */
|
36
|
+
paddingTop: number;
|
37
|
+
/** @type {number} */
|
38
|
+
paddingBottom: number;
|
39
|
+
/** @type {number} */
|
40
|
+
paddingLeft: number;
|
41
|
+
/** @type {number} */
|
42
|
+
paddingRight: number;
|
43
|
+
/** @type {string=} */
|
44
|
+
axis: string | undefined;
|
45
|
+
/** @type {number=} */
|
46
|
+
labelRotation: number | undefined;
|
47
|
+
min: any;
|
48
|
+
max: any;
|
49
|
+
_range: {
|
50
|
+
min: number;
|
51
|
+
max: number;
|
52
|
+
};
|
53
|
+
/** @type {Tick[]} */
|
54
|
+
ticks: Tick[];
|
55
|
+
/** @type {object[]|null} */
|
56
|
+
_gridLineItems: object[] | null;
|
57
|
+
/** @type {object[]|null} */
|
58
|
+
_labelItems: object[] | null;
|
59
|
+
/** @type {object|null} */
|
60
|
+
_labelSizes: object | null;
|
61
|
+
_length: number;
|
62
|
+
_maxLength: number;
|
63
|
+
_longestTextCache: {};
|
64
|
+
/** @type {number} */
|
65
|
+
_startPixel: number;
|
66
|
+
/** @type {number} */
|
67
|
+
_endPixel: number;
|
68
|
+
_reversePixels: boolean;
|
69
|
+
_userMax: any;
|
70
|
+
_userMin: any;
|
71
|
+
_suggestedMax: any;
|
72
|
+
_suggestedMin: any;
|
73
|
+
_ticksLength: number;
|
74
|
+
_borderValue: number;
|
75
|
+
_cache: {};
|
76
|
+
_dataLimitsCached: boolean;
|
77
|
+
$context: any;
|
78
|
+
/**
|
79
|
+
* @param {any} options
|
80
|
+
* @since 3.0
|
81
|
+
*/
|
82
|
+
init(options: any): void;
|
83
|
+
/**
|
84
|
+
* Parse a supported input value to internal representation.
|
85
|
+
* @param {*} raw
|
86
|
+
* @param {number} [index]
|
87
|
+
* @since 3.0
|
88
|
+
*/
|
89
|
+
parse(raw: any, index?: number): any;
|
90
|
+
/**
|
91
|
+
* @return {{min: number, max: number, minDefined: boolean, maxDefined: boolean}}
|
92
|
+
* @protected
|
93
|
+
* @since 3.0
|
94
|
+
*/
|
95
|
+
protected getUserBounds(): {
|
96
|
+
min: number;
|
97
|
+
max: number;
|
98
|
+
minDefined: boolean;
|
99
|
+
maxDefined: boolean;
|
100
|
+
};
|
101
|
+
/**
|
102
|
+
* @param {boolean} canStack
|
103
|
+
* @return {{min: number, max: number}}
|
104
|
+
* @protected
|
105
|
+
* @since 3.0
|
106
|
+
*/
|
107
|
+
protected getMinMax(canStack: boolean): {
|
108
|
+
min: number;
|
109
|
+
max: number;
|
110
|
+
};
|
111
|
+
/**
|
112
|
+
* Get the padding needed for the scale
|
113
|
+
* @return {{top: number, left: number, bottom: number, right: number}} the necessary padding
|
114
|
+
* @private
|
115
|
+
*/
|
116
|
+
private getPadding;
|
117
|
+
/**
|
118
|
+
* Returns the scale tick objects
|
119
|
+
* @return {Tick[]}
|
120
|
+
* @since 2.7
|
121
|
+
*/
|
122
|
+
getTicks(): Tick[];
|
123
|
+
/**
|
124
|
+
* @return {string[]}
|
125
|
+
*/
|
126
|
+
getLabels(): string[];
|
127
|
+
/**
|
128
|
+
* @return {import('../types.js').LabelItem[]}
|
129
|
+
*/
|
130
|
+
getLabelItems(chartArea?: import("../types.js").ChartArea): import('../types.js').LabelItem[];
|
131
|
+
beforeLayout(): void;
|
132
|
+
beforeUpdate(): void;
|
133
|
+
/**
|
134
|
+
* @param {number} maxWidth - the max width in pixels
|
135
|
+
* @param {number} maxHeight - the max height in pixels
|
136
|
+
* @param {{top: number, left: number, bottom: number, right: number}} margins - the space between the edge of the other scales and edge of the chart
|
137
|
+
* This space comes from two sources:
|
138
|
+
* - padding - space that's required to show the labels at the edges of the scale
|
139
|
+
* - thickness of scales or legends in another orientation
|
140
|
+
*/
|
141
|
+
update(maxWidth: number, maxHeight: number, margins: {
|
142
|
+
top: number;
|
143
|
+
left: number;
|
144
|
+
bottom: number;
|
145
|
+
right: number;
|
146
|
+
}): void;
|
147
|
+
/**
|
148
|
+
* @protected
|
149
|
+
*/
|
150
|
+
protected configure(): void;
|
151
|
+
_alignToPixels: any;
|
152
|
+
afterUpdate(): void;
|
153
|
+
beforeSetDimensions(): void;
|
154
|
+
setDimensions(): void;
|
155
|
+
afterSetDimensions(): void;
|
156
|
+
_callHooks(name: any): void;
|
157
|
+
beforeDataLimits(): void;
|
158
|
+
determineDataLimits(): void;
|
159
|
+
afterDataLimits(): void;
|
160
|
+
beforeBuildTicks(): void;
|
161
|
+
/**
|
162
|
+
* @return {object[]} the ticks
|
163
|
+
*/
|
164
|
+
buildTicks(): object[];
|
165
|
+
afterBuildTicks(): void;
|
166
|
+
beforeTickToLabelConversion(): void;
|
167
|
+
/**
|
168
|
+
* Convert ticks to label strings
|
169
|
+
* @param {Tick[]} ticks
|
170
|
+
*/
|
171
|
+
generateTickLabels(ticks: Tick[]): void;
|
172
|
+
afterTickToLabelConversion(): void;
|
173
|
+
beforeCalculateLabelRotation(): void;
|
174
|
+
calculateLabelRotation(): void;
|
175
|
+
afterCalculateLabelRotation(): void;
|
176
|
+
afterAutoSkip(): void;
|
177
|
+
beforeFit(): void;
|
178
|
+
fit(): void;
|
179
|
+
_calculatePadding(first: any, last: any, sin: any, cos: any): void;
|
180
|
+
/**
|
181
|
+
* Handle margins and padding interactions
|
182
|
+
* @private
|
183
|
+
*/
|
184
|
+
private _handleMargins;
|
185
|
+
afterFit(): void;
|
186
|
+
/**
|
187
|
+
* @return {boolean}
|
188
|
+
*/
|
189
|
+
isHorizontal(): boolean;
|
190
|
+
/**
|
191
|
+
* @return {boolean}
|
192
|
+
*/
|
193
|
+
isFullSize(): boolean;
|
194
|
+
/**
|
195
|
+
* @param {Tick[]} ticks
|
196
|
+
* @private
|
197
|
+
*/
|
198
|
+
private _convertTicksToLabels;
|
199
|
+
/**
|
200
|
+
* @return {{ first: object, last: object, widest: object, highest: object, widths: Array, heights: array }}
|
201
|
+
* @private
|
202
|
+
*/
|
203
|
+
private _getLabelSizes;
|
204
|
+
/**
|
205
|
+
* Returns {width, height, offset} objects for the first, last, widest, highest tick
|
206
|
+
* labels where offset indicates the anchor point offset from the top in pixels.
|
207
|
+
* @return {{ first: object, last: object, widest: object, highest: object, widths: Array, heights: array }}
|
208
|
+
* @private
|
209
|
+
*/
|
210
|
+
private _computeLabelSizes;
|
211
|
+
/**
|
212
|
+
* Used to get the label to display in the tooltip for the given value
|
213
|
+
* @param {*} value
|
214
|
+
* @return {string}
|
215
|
+
*/
|
216
|
+
getLabelForValue(value: any): string;
|
217
|
+
/**
|
218
|
+
* Returns the location of the given data point. Value can either be an index or a numerical value
|
219
|
+
* The coordinate (0, 0) is at the upper-left corner of the canvas
|
220
|
+
* @param {*} value
|
221
|
+
* @param {number} [index]
|
222
|
+
* @return {number}
|
223
|
+
*/
|
224
|
+
getPixelForValue(value: any, index?: number): number;
|
225
|
+
/**
|
226
|
+
* Used to get the data value from a given pixel. This is the inverse of getPixelForValue
|
227
|
+
* The coordinate (0, 0) is at the upper-left corner of the canvas
|
228
|
+
* @param {number} pixel
|
229
|
+
* @return {*}
|
230
|
+
*/
|
231
|
+
getValueForPixel(pixel: number): any;
|
232
|
+
/**
|
233
|
+
* Returns the location of the tick at the given index
|
234
|
+
* The coordinate (0, 0) is at the upper-left corner of the canvas
|
235
|
+
* @param {number} index
|
236
|
+
* @return {number}
|
237
|
+
*/
|
238
|
+
getPixelForTick(index: number): number;
|
239
|
+
/**
|
240
|
+
* Utility for getting the pixel location of a percentage of scale
|
241
|
+
* The coordinate (0, 0) is at the upper-left corner of the canvas
|
242
|
+
* @param {number} decimal
|
243
|
+
* @return {number}
|
244
|
+
*/
|
245
|
+
getPixelForDecimal(decimal: number): number;
|
246
|
+
/**
|
247
|
+
* @param {number} pixel
|
248
|
+
* @return {number}
|
249
|
+
*/
|
250
|
+
getDecimalForPixel(pixel: number): number;
|
251
|
+
/**
|
252
|
+
* Returns the pixel for the minimum chart value
|
253
|
+
* The coordinate (0, 0) is at the upper-left corner of the canvas
|
254
|
+
* @return {number}
|
255
|
+
*/
|
256
|
+
getBasePixel(): number;
|
257
|
+
/**
|
258
|
+
* @return {number}
|
259
|
+
*/
|
260
|
+
getBaseValue(): number;
|
261
|
+
/**
|
262
|
+
* @protected
|
263
|
+
*/
|
264
|
+
protected getContext(index: any): any;
|
265
|
+
/**
|
266
|
+
* @return {number}
|
267
|
+
* @private
|
268
|
+
*/
|
269
|
+
private _tickSize;
|
270
|
+
/**
|
271
|
+
* @return {boolean}
|
272
|
+
* @private
|
273
|
+
*/
|
274
|
+
private _isVisible;
|
275
|
+
/**
|
276
|
+
* @private
|
277
|
+
*/
|
278
|
+
private _computeGridLineItems;
|
279
|
+
/**
|
280
|
+
* @private
|
281
|
+
*/
|
282
|
+
private _computeLabelItems;
|
283
|
+
_getXAxisLabelAlignment(): string;
|
284
|
+
_getYAxisLabelAlignment(tl: any): {
|
285
|
+
textAlign: string;
|
286
|
+
x: any;
|
287
|
+
};
|
288
|
+
/**
|
289
|
+
* @private
|
290
|
+
*/
|
291
|
+
private _computeLabelArea;
|
292
|
+
/**
|
293
|
+
* @protected
|
294
|
+
*/
|
295
|
+
protected drawBackground(): void;
|
296
|
+
getLineWidthForValue(value: any): any;
|
297
|
+
/**
|
298
|
+
* @protected
|
299
|
+
*/
|
300
|
+
protected drawGrid(chartArea: any): void;
|
301
|
+
/**
|
302
|
+
* @protected
|
303
|
+
*/
|
304
|
+
protected drawBorder(): void;
|
305
|
+
/**
|
306
|
+
* @protected
|
307
|
+
*/
|
308
|
+
protected drawLabels(chartArea: any): void;
|
309
|
+
/**
|
310
|
+
* @protected
|
311
|
+
*/
|
312
|
+
protected drawTitle(): void;
|
313
|
+
draw(chartArea: any): void;
|
314
|
+
/**
|
315
|
+
* @return {object[]}
|
316
|
+
* @private
|
317
|
+
*/
|
318
|
+
private _layers;
|
319
|
+
/**
|
320
|
+
* Returns visible dataset metas that are attached to this scale
|
321
|
+
* @param {string} [type] - if specified, also filter by dataset type
|
322
|
+
* @return {object[]}
|
323
|
+
*/
|
324
|
+
getMatchingVisibleMetas(type?: string): object[];
|
325
|
+
/**
|
326
|
+
* @param {number} index
|
327
|
+
* @return {object}
|
328
|
+
* @protected
|
329
|
+
*/
|
330
|
+
protected _resolveTickFontOptions(index: number): object;
|
331
|
+
/**
|
332
|
+
* @protected
|
333
|
+
*/
|
334
|
+
protected _maxDigits(): number;
|
335
|
+
}
|
336
|
+
export type Chart = import('../types/index.js').Chart;
|
337
|
+
export type Tick = {
|
338
|
+
value: number | string;
|
339
|
+
label?: string;
|
340
|
+
major?: boolean;
|
341
|
+
$context?: any;
|
342
|
+
};
|
343
|
+
import Element from "./core.element.js";
|
@@ -0,0 +1 @@
|
|
1
|
+
export function applyScaleDefaults(defaults: any): void;
|
@@ -0,0 +1,31 @@
|
|
1
|
+
declare namespace _default {
|
2
|
+
export { formatters };
|
3
|
+
}
|
4
|
+
export default _default;
|
5
|
+
declare namespace formatters {
|
6
|
+
/**
|
7
|
+
* Formatter for value labels
|
8
|
+
* @method Chart.Ticks.formatters.values
|
9
|
+
* @param value the value to display
|
10
|
+
* @return {string|string[]} the label to display
|
11
|
+
*/
|
12
|
+
function values(value: any): string | string[];
|
13
|
+
/**
|
14
|
+
* Formatter for numeric ticks
|
15
|
+
* @method Chart.Ticks.formatters.numeric
|
16
|
+
* @param tickValue {number} the value to be formatted
|
17
|
+
* @param index {number} the position of the tickValue parameter in the ticks array
|
18
|
+
* @param ticks {object[]} the list of ticks being converted
|
19
|
+
* @return {string} string representation of the tickValue parameter
|
20
|
+
*/
|
21
|
+
function numeric(tickValue: number, index: number, ticks: any[]): string;
|
22
|
+
/**
|
23
|
+
* Formatter for logarithmic ticks
|
24
|
+
* @method Chart.Ticks.formatters.logarithmic
|
25
|
+
* @param tickValue {number} the value to be formatted
|
26
|
+
* @param index {number} the position of the tickValue parameter in the ticks array
|
27
|
+
* @param ticks {object[]} the list of ticks being converted
|
28
|
+
* @return {string} string representation of the tickValue parameter
|
29
|
+
*/
|
30
|
+
function logarithmic(tickValue: number, index: number, ticks: any[]): string;
|
31
|
+
}
|
@@ -0,0 +1,33 @@
|
|
1
|
+
/**
|
2
|
+
* @typedef {{id: string, defaults: any, overrides?: any, defaultRoutes: any}} IChartComponent
|
3
|
+
*/
|
4
|
+
export default class TypedRegistry {
|
5
|
+
constructor(type: any, scope: any, override: any);
|
6
|
+
type: any;
|
7
|
+
scope: any;
|
8
|
+
override: any;
|
9
|
+
items: any;
|
10
|
+
isForType(type: any): boolean;
|
11
|
+
/**
|
12
|
+
* @param {IChartComponent} item
|
13
|
+
* @returns {string} The scope where items defaults were registered to.
|
14
|
+
*/
|
15
|
+
register(item: IChartComponent): string;
|
16
|
+
/**
|
17
|
+
* @param {string} id
|
18
|
+
* @returns {object?}
|
19
|
+
*/
|
20
|
+
get(id: string): object | null;
|
21
|
+
/**
|
22
|
+
* @param {IChartComponent} item
|
23
|
+
*/
|
24
|
+
unregister(item: IChartComponent): void;
|
25
|
+
}
|
26
|
+
export type IChartComponent = {
|
27
|
+
id: string;
|
28
|
+
defaults: any;
|
29
|
+
overrides?: any;
|
30
|
+
defaultRoutes: any;
|
31
|
+
};
|
32
|
+
import defaults from "./core.defaults.js";
|
33
|
+
import { overrides } from "./core.defaults.js";
|
@@ -0,0 +1,15 @@
|
|
1
|
+
export type { DateAdapter, TimeUnit } from './core.adapters.js';
|
2
|
+
export { default as _adapters } from './core.adapters.js';
|
3
|
+
export { default as Animation } from './core.animation.js';
|
4
|
+
export { default as Animations } from './core.animations.js';
|
5
|
+
export { default as animator } from './core.animator.js';
|
6
|
+
export { default as Chart } from './core.controller.js';
|
7
|
+
export { default as DatasetController } from './core.datasetController.js';
|
8
|
+
export { default as defaults } from './core.defaults.js';
|
9
|
+
export { default as Element } from './core.element.js';
|
10
|
+
export { default as Interaction } from './core.interaction.js';
|
11
|
+
export { default as layouts } from './core.layouts.js';
|
12
|
+
export { default as plugins } from './core.plugins.js';
|
13
|
+
export { default as registry } from './core.registry.js';
|
14
|
+
export { default as Scale } from './core.scale.js';
|
15
|
+
export { default as Ticks } from './core.ticks.js';
|