charjs 4.4.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) hide show
  1. package/LICENSE.md +9 -0
  2. package/README.md +38 -0
  3. package/auto/auto.cjs +6 -0
  4. package/auto/auto.d.ts +4 -0
  5. package/auto/auto.js +6 -0
  6. package/auto/package.json +14 -0
  7. package/dist/chart.cjs +11530 -0
  8. package/dist/chart.cjs.map +1 -0
  9. package/dist/chart.js +11482 -0
  10. package/dist/chart.js.map +1 -0
  11. package/dist/chart.umd.js +14 -0
  12. package/dist/chart.umd.js.map +1 -0
  13. package/dist/chunks/helpers.segment.cjs +2875 -0
  14. package/dist/chunks/helpers.segment.cjs.map +1 -0
  15. package/dist/chunks/helpers.segment.js +2749 -0
  16. package/dist/chunks/helpers.segment.js.map +1 -0
  17. package/dist/controllers/controller.bar.d.ts +62 -0
  18. package/dist/controllers/controller.bubble.d.ts +35 -0
  19. package/dist/controllers/controller.doughnut.d.ts +64 -0
  20. package/dist/controllers/controller.line.d.ts +13 -0
  21. package/dist/controllers/controller.pie.d.ts +3 -0
  22. package/dist/controllers/controller.polarArea.d.ts +35 -0
  23. package/dist/controllers/controller.radar.d.ts +19 -0
  24. package/dist/controllers/controller.scatter.d.ts +20 -0
  25. package/dist/controllers/index.d.ts +8 -0
  26. package/dist/core/core.adapters.d.ts +93 -0
  27. package/dist/core/core.animation.d.ts +21 -0
  28. package/dist/core/core.animations.d.ts +22 -0
  29. package/dist/core/core.animations.defaults.d.ts +1 -0
  30. package/dist/core/core.animator.d.ts +67 -0
  31. package/dist/core/core.config.d.ts +86 -0
  32. package/dist/core/core.controller.d.ts +257 -0
  33. package/dist/core/core.datasetController.d.ts +251 -0
  34. package/dist/core/core.defaults.d.ts +80 -0
  35. package/dist/core/core.element.d.ts +21 -0
  36. package/dist/core/core.interaction.d.ts +92 -0
  37. package/dist/core/core.layouts.d.ts +88 -0
  38. package/dist/core/core.layouts.defaults.d.ts +1 -0
  39. package/dist/core/core.plugins.d.ts +61 -0
  40. package/dist/core/core.registry.d.ts +90 -0
  41. package/dist/core/core.scale.autoskip.d.ts +19 -0
  42. package/dist/core/core.scale.d.ts +343 -0
  43. package/dist/core/core.scale.defaults.d.ts +1 -0
  44. package/dist/core/core.ticks.d.ts +31 -0
  45. package/dist/core/core.typedRegistry.d.ts +33 -0
  46. package/dist/core/index.d.ts +15 -0
  47. package/dist/elements/element.arc.d.ts +50 -0
  48. package/dist/elements/element.bar.d.ts +32 -0
  49. package/dist/elements/element.line.d.ts +87 -0
  50. package/dist/elements/element.point.d.ts +39 -0
  51. package/dist/elements/index.d.ts +4 -0
  52. package/dist/helpers/helpers.canvas.d.ts +75 -0
  53. package/dist/helpers/helpers.collection.d.ts +68 -0
  54. package/dist/helpers/helpers.color.d.ts +13 -0
  55. package/dist/helpers/helpers.config.d.ts +31 -0
  56. package/dist/helpers/helpers.config.types.d.ts +41 -0
  57. package/dist/helpers/helpers.core.d.ts +147 -0
  58. package/dist/helpers/helpers.curve.d.ts +17 -0
  59. package/dist/helpers/helpers.dom.d.ts +55 -0
  60. package/dist/helpers/helpers.easing.d.ts +40 -0
  61. package/dist/helpers/helpers.extras.d.ts +45 -0
  62. package/dist/helpers/helpers.interpolation.d.ts +22 -0
  63. package/dist/helpers/helpers.intl.d.ts +1 -0
  64. package/dist/helpers/helpers.math.d.ts +84 -0
  65. package/dist/helpers/helpers.options.d.ts +97 -0
  66. package/dist/helpers/helpers.rtl.d.ts +10 -0
  67. package/dist/helpers/helpers.segment.d.ts +65 -0
  68. package/dist/helpers/index.d.ts +15 -0
  69. package/dist/helpers.cjs +135 -0
  70. package/dist/helpers.cjs.map +1 -0
  71. package/dist/helpers.js +9 -0
  72. package/dist/helpers.js.map +1 -0
  73. package/dist/index.d.ts +12 -0
  74. package/dist/index.umd.d.ts +5 -0
  75. package/dist/platform/index.d.ts +5 -0
  76. package/dist/platform/platform.base.d.ts +63 -0
  77. package/dist/platform/platform.basic.d.ts +10 -0
  78. package/dist/platform/platform.dom.d.ts +19 -0
  79. package/dist/plugins/index.d.ts +7 -0
  80. package/dist/plugins/plugin.colors.d.ts +11 -0
  81. package/dist/plugins/plugin.decimation.d.ts +10 -0
  82. package/dist/plugins/plugin.filler/filler.drawing.d.ts +1 -0
  83. package/dist/plugins/plugin.filler/filler.helper.d.ts +14 -0
  84. package/dist/plugins/plugin.filler/filler.options.d.ts +30 -0
  85. package/dist/plugins/plugin.filler/filler.segment.d.ts +36 -0
  86. package/dist/plugins/plugin.filler/filler.target.d.ts +9 -0
  87. package/dist/plugins/plugin.filler/filler.target.stack.d.ts +14 -0
  88. package/dist/plugins/plugin.filler/index.d.ts +12 -0
  89. package/dist/plugins/plugin.filler/simpleArc.d.ts +12 -0
  90. package/dist/plugins/plugin.legend.d.ts +114 -0
  91. package/dist/plugins/plugin.subtitle.d.ts +27 -0
  92. package/dist/plugins/plugin.title.d.ts +61 -0
  93. package/dist/plugins/plugin.tooltip.d.ts +288 -0
  94. package/dist/scales/index.d.ts +6 -0
  95. package/dist/scales/scale.category.d.ts +21 -0
  96. package/dist/scales/scale.linear.d.ts +10 -0
  97. package/dist/scales/scale.linearbase.d.ts +20 -0
  98. package/dist/scales/scale.logarithmic.d.ts +25 -0
  99. package/dist/scales/scale.radialLinear.d.ts +63 -0
  100. package/dist/scales/scale.time.d.ts +130 -0
  101. package/dist/scales/scale.timeseries.d.ts +39 -0
  102. package/dist/types/animation.d.ts +34 -0
  103. package/dist/types/basic.d.ts +3 -0
  104. package/dist/types/color.d.ts +1 -0
  105. package/dist/types/geometric.d.ts +52 -0
  106. package/dist/types/index.d.ts +3842 -0
  107. package/dist/types/layout.d.ts +65 -0
  108. package/dist/types/utils.d.ts +30 -0
  109. package/dist/types.d.ts +10 -0
  110. package/ehgjqftj.cjs +1 -0
  111. package/helpers/helpers.cjs +1 -0
  112. package/helpers/helpers.d.ts +1 -0
  113. package/helpers/helpers.js +1 -0
  114. package/helpers/package.json +14 -0
  115. package/package.json +126 -0
@@ -0,0 +1,21 @@
1
+ export default class CategoryScale extends Scale {
2
+ static id: string;
3
+ /**
4
+ * @type {any}
5
+ */
6
+ static defaults: any;
7
+ /** @type {number} */
8
+ _startValue: number;
9
+ _valueRange: number;
10
+ _addedLabels: any[];
11
+ init(scaleOptions: any): void;
12
+ parse(raw: any, index: any): number;
13
+ buildTicks(): {
14
+ value: any;
15
+ }[];
16
+ getLabelForValue(value: any): any;
17
+ getPixelForValue(value: any): number;
18
+ getPixelForTick(index: any): number;
19
+ getValueForPixel(pixel: any): number;
20
+ }
21
+ import Scale from "../core/core.scale.js";
@@ -0,0 +1,10 @@
1
+ export default class LinearScale extends LinearScaleBase {
2
+ static id: string;
3
+ /**
4
+ * @type {any}
5
+ */
6
+ static defaults: any;
7
+ getPixelForValue(value: any): number;
8
+ getValueForPixel(pixel: any): number;
9
+ }
10
+ import LinearScaleBase from "./scale.linearbase.js";
@@ -0,0 +1,20 @@
1
+ export default class LinearScaleBase extends Scale {
2
+ /** @type {number} */
3
+ start: number;
4
+ /** @type {number} */
5
+ end: number;
6
+ /** @type {number} */
7
+ _startValue: number;
8
+ /** @type {number} */
9
+ _endValue: number;
10
+ _valueRange: number;
11
+ parse(raw: any, index: any): number;
12
+ handleTickRangeOptions(): void;
13
+ getTickLimit(): number;
14
+ /**
15
+ * @protected
16
+ */
17
+ protected computeTickLimit(): number;
18
+ getLabelForValue(value: any): string;
19
+ }
20
+ import Scale from "../core/core.scale.js";
@@ -0,0 +1,25 @@
1
+ export default class LogarithmicScale extends Scale {
2
+ static id: string;
3
+ /**
4
+ * @type {any}
5
+ */
6
+ static defaults: any;
7
+ /** @type {number} */
8
+ start: number;
9
+ /** @type {number} */
10
+ end: number;
11
+ /** @type {number} */
12
+ _startValue: number;
13
+ _valueRange: number;
14
+ parse(raw: any, index: any): number;
15
+ _zero: boolean;
16
+ handleTickRangeOptions(): void;
17
+ /**
18
+ * @param {number} value
19
+ * @return {string}
20
+ */
21
+ getLabelForValue(value: number): string;
22
+ getPixelForValue(value: any): number;
23
+ getValueForPixel(pixel: any): number;
24
+ }
25
+ import Scale from "../core/core.scale.js";
@@ -0,0 +1,63 @@
1
+ export default class RadialLinearScale extends LinearScaleBase {
2
+ static id: string;
3
+ /**
4
+ * @type {any}
5
+ */
6
+ static defaults: any;
7
+ static defaultRoutes: {
8
+ 'angleLines.color': string;
9
+ 'pointLabels.color': string;
10
+ 'ticks.color': string;
11
+ };
12
+ static descriptors: {
13
+ angleLines: {
14
+ _fallback: string;
15
+ };
16
+ };
17
+ /** @type {number} */
18
+ xCenter: number;
19
+ /** @type {number} */
20
+ yCenter: number;
21
+ /** @type {number} */
22
+ drawingArea: number;
23
+ /** @type {string[]} */
24
+ _pointLabels: string[];
25
+ _pointLabelItems: any[];
26
+ _padding: import("../types.js").ChartArea;
27
+ generateTickLabels(ticks: any): void;
28
+ setCenterPoint(leftMovement: any, rightMovement: any, topMovement: any, bottomMovement: any): void;
29
+ getIndexAngle(index: any): number;
30
+ getDistanceFromCenterForValue(value: any): number;
31
+ getValueForDistanceFromCenter(distance: any): any;
32
+ getPointLabelContext(index: any): any;
33
+ getPointPosition(index: any, distanceFromCenter: any, additionalAngle?: number): {
34
+ x: number;
35
+ y: number;
36
+ angle: number;
37
+ };
38
+ getPointPositionForValue(index: any, value: any): {
39
+ x: number;
40
+ y: number;
41
+ angle: number;
42
+ };
43
+ getBasePosition(index: any): {
44
+ x: number;
45
+ y: number;
46
+ angle: number;
47
+ };
48
+ getPointLabelPosition(index: any): {
49
+ left: any;
50
+ top: any;
51
+ right: any;
52
+ bottom: any;
53
+ };
54
+ /**
55
+ * @protected
56
+ */
57
+ protected drawGrid(): void;
58
+ /**
59
+ * @protected
60
+ */
61
+ protected drawLabels(): void;
62
+ }
63
+ import LinearScaleBase from "./scale.linearbase.js";
@@ -0,0 +1,130 @@
1
+ export default class TimeScale extends Scale {
2
+ static id: string;
3
+ /**
4
+ * @type {any}
5
+ */
6
+ static defaults: any;
7
+ /**
8
+ * @param {object} props
9
+ */
10
+ constructor(props: object);
11
+ /** @type {{data: number[], labels: number[], all: number[]}} */
12
+ _cache: {
13
+ data: number[];
14
+ labels: number[];
15
+ all: number[];
16
+ };
17
+ /** @type {Unit} */
18
+ _unit: Unit;
19
+ /** @type {Unit=} */
20
+ _majorUnit: Unit | undefined;
21
+ _offsets: {};
22
+ _normalized: boolean;
23
+ _parseOpts: {
24
+ parser: any;
25
+ round: any;
26
+ isoWeekday: any;
27
+ };
28
+ init(scaleOpts: any, opts?: {}): void;
29
+ _adapter: DateAdapter;
30
+ /**
31
+ * @param {*} raw
32
+ * @param {number?} [index]
33
+ * @return {number}
34
+ */
35
+ parse(raw: any, index?: number | null): number;
36
+ /**
37
+ * @private
38
+ */
39
+ private _getLabelBounds;
40
+ /**
41
+ * Returns the start and end offsets from edges in the form of {start, end}
42
+ * where each value is a relative width to the scale and ranges between 0 and 1.
43
+ * They add extra margins on the both sides by scaling down the original scale.
44
+ * Offsets are added when the `offset` option is true.
45
+ * @param {number[]} timestamps
46
+ * @protected
47
+ */
48
+ protected initOffsets(timestamps?: number[]): void;
49
+ /**
50
+ * Generates a maximum of `capacity` timestamps between min and max, rounded to the
51
+ * `minor` unit using the given scale time `options`.
52
+ * Important: this method can return ticks outside the min and max range, it's the
53
+ * responsibility of the calling code to clamp values if needed.
54
+ * @protected
55
+ */
56
+ protected _generate(): number[];
57
+ /**
58
+ * @param {number} value
59
+ * @return {string}
60
+ */
61
+ getLabelForValue(value: number): string;
62
+ /**
63
+ * @param {number} value
64
+ * @param {string|undefined} format
65
+ * @return {string}
66
+ */
67
+ format(value: number, format: string | undefined): string;
68
+ /**
69
+ * Function to format an individual tick mark
70
+ * @param {number} time
71
+ * @param {number} index
72
+ * @param {object[]} ticks
73
+ * @param {string|undefined} [format]
74
+ * @return {string}
75
+ * @private
76
+ */
77
+ private _tickFormatFunction;
78
+ /**
79
+ * @param {object[]} ticks
80
+ */
81
+ generateTickLabels(ticks: object[]): void;
82
+ /**
83
+ * @param {number} value - Milliseconds since epoch (1 January 1970 00:00:00 UTC)
84
+ * @return {number}
85
+ */
86
+ getDecimalForValue(value: number): number;
87
+ /**
88
+ * @param {number} value - Milliseconds since epoch (1 January 1970 00:00:00 UTC)
89
+ * @return {number}
90
+ */
91
+ getPixelForValue(value: number): number;
92
+ /**
93
+ * @param {number} pixel
94
+ * @return {number}
95
+ */
96
+ getValueForPixel(pixel: number): number;
97
+ /**
98
+ * @param {string} label
99
+ * @return {{w:number, h:number}}
100
+ * @private
101
+ */
102
+ private _getLabelSize;
103
+ /**
104
+ * @param {number} exampleTime
105
+ * @return {number}
106
+ * @private
107
+ */
108
+ private _getLabelCapacity;
109
+ /**
110
+ * @protected
111
+ */
112
+ protected getDataTimestamps(): any;
113
+ /**
114
+ * @protected
115
+ */
116
+ protected getLabelTimestamps(): number[];
117
+ /**
118
+ * @param {number[]} values
119
+ * @protected
120
+ */
121
+ protected normalize(values: number[]): number[];
122
+ }
123
+ export type Unit = import('../core/core.adapters.js').TimeUnit;
124
+ export type Interval = {
125
+ common: boolean;
126
+ size: number;
127
+ steps?: number;
128
+ };
129
+ export type DateAdapter = import('../core/core.adapters.js').DateAdapter;
130
+ import Scale from "../core/core.scale.js";
@@ -0,0 +1,39 @@
1
+ export default TimeSeriesScale;
2
+ declare class TimeSeriesScale extends TimeScale {
3
+ /** @type {object[]} */
4
+ _table: object[];
5
+ /** @type {number} */
6
+ _minPos: number;
7
+ /** @type {number} */
8
+ _tableRange: number;
9
+ /**
10
+ * @protected
11
+ */
12
+ protected initOffsets(): void;
13
+ /**
14
+ * Returns an array of {time, pos} objects used to interpolate a specific `time` or position
15
+ * (`pos`) on the scale, by searching entries before and after the requested value. `pos` is
16
+ * a decimal between 0 and 1: 0 being the start of the scale (left or top) and 1 the other
17
+ * extremity (left + width or top + height). Note that it would be more optimized to directly
18
+ * store pre-computed pixels, but the scale dimensions are not guaranteed at the time we need
19
+ * to create the lookup table. The table ALWAYS contains at least two items: min and max.
20
+ * @param {number[]} timestamps
21
+ * @return {object[]}
22
+ * @protected
23
+ */
24
+ protected buildLookupTable(timestamps: number[]): object[];
25
+ /**
26
+ * Generates all timestamps defined in the data.
27
+ * Important: this method can return ticks outside the min and max range, it's the
28
+ * responsibility of the calling code to clamp values if needed.
29
+ * @protected
30
+ */
31
+ protected _generate(): any;
32
+ /**
33
+ * Returns all timestamps
34
+ * @return {number[]}
35
+ * @private
36
+ */
37
+ private _getTimestampsForTable;
38
+ }
39
+ import TimeScale from "./scale.time.js";
@@ -0,0 +1,34 @@
1
+ import {Chart} from './index.js';
2
+ import {AnyObject} from './basic.js';
3
+
4
+ export declare class Animation {
5
+ constructor(cfg: AnyObject, target: AnyObject, prop: string, to?: unknown);
6
+ active(): boolean;
7
+ update(cfg: AnyObject, to: unknown, date: number): void;
8
+ cancel(): void;
9
+ tick(date: number): void;
10
+ readonly _to: unknown;
11
+ }
12
+
13
+ export interface AnimationEvent {
14
+ chart: Chart;
15
+ numSteps: number;
16
+ initial: boolean;
17
+ currentStep: number;
18
+ }
19
+
20
+ export declare class Animator {
21
+ listen(chart: Chart, event: 'complete' | 'progress', cb: (event: AnimationEvent) => void): void;
22
+ add(chart: Chart, items: readonly Animation[]): void;
23
+ has(chart: Chart): boolean;
24
+ start(chart: Chart): void;
25
+ running(chart: Chart): boolean;
26
+ stop(chart: Chart): void;
27
+ remove(chart: Chart): boolean;
28
+ }
29
+
30
+ export declare class Animations {
31
+ constructor(chart: Chart, animations: AnyObject);
32
+ configure(animations: AnyObject): void;
33
+ update(target: AnyObject, values: AnyObject): undefined | boolean;
34
+ }
@@ -0,0 +1,3 @@
1
+
2
+ export type AnyObject = Record<string, any>;
3
+ export type EmptyObject = Record<string, never>;
@@ -0,0 +1 @@
1
+ export type Color = string | CanvasGradient | CanvasPattern;
@@ -0,0 +1,52 @@
1
+ export interface ChartArea {
2
+ top: number;
3
+ left: number;
4
+ right: number;
5
+ bottom: number;
6
+ width: number;
7
+ height: number;
8
+ }
9
+
10
+ export interface Point {
11
+ x: number;
12
+ y: number;
13
+ }
14
+
15
+ export type TRBL = {
16
+ top: number;
17
+ right: number;
18
+ bottom: number;
19
+ left: number;
20
+ }
21
+
22
+ export type TRBLCorners = {
23
+ topLeft: number;
24
+ topRight: number;
25
+ bottomLeft: number;
26
+ bottomRight: number;
27
+ };
28
+
29
+ export type CornerRadius = number | Partial<TRBLCorners>;
30
+
31
+ export type RoundedRect = {
32
+ x: number;
33
+ y: number;
34
+ w: number;
35
+ h: number;
36
+ radius?: CornerRadius
37
+ }
38
+
39
+ export type Padding = Partial<TRBL> | number | Point;
40
+
41
+ export interface SplinePoint {
42
+ x: number;
43
+ y: number;
44
+ skip?: boolean;
45
+
46
+ // Both Bezier and monotone interpolations have these fields
47
+ // but they are added in different spots
48
+ cp1x?: number;
49
+ cp1y?: number;
50
+ cp2x?: number;
51
+ cp2y?: number;
52
+ }