billboard.js 3.9.4 → 3.10.0-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/billboard.css +2 -2
- package/dist/billboard.js +2742 -2516
- package/dist/billboard.min.css +2 -2
- package/dist/billboard.min.js +2 -2
- package/dist/billboard.pkgd.js +2936 -2704
- package/dist/billboard.pkgd.min.js +4 -4
- package/dist/plugin/billboardjs-plugin-bubblecompare.js +15 -15
- package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-sparkline.js +205 -186
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-stanford.js +231 -226
- package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-tableview.js +172 -152
- package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-textoverlap.js +161 -142
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
- package/dist/plugin/pkgd/{billboardjs-plugin-bubblecompare.js → billboardjs-plugin-bubblecompare.pkgd.js} +52 -32
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.min.js +12 -0
- package/dist/plugin/pkgd/{billboardjs-plugin-sparkline.js → billboardjs-plugin-sparkline.pkgd.js} +239 -200
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +12 -0
- package/dist/plugin/pkgd/{billboardjs-plugin-stanford.js → billboardjs-plugin-stanford.pkgd.js} +301 -277
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +12 -0
- package/dist/plugin/pkgd/{billboardjs-plugin-tableview.js → billboardjs-plugin-tableview.pkgd.js} +206 -166
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +12 -0
- package/dist/plugin/pkgd/{billboardjs-plugin-textoverlap.js → billboardjs-plugin-textoverlap.pkgd.js} +308 -278
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.min.js +12 -0
- package/dist/theme/dark.css +5 -4
- package/dist/theme/dark.min.css +2 -2
- package/dist/theme/datalab.css +5 -4
- package/dist/theme/datalab.min.css +2 -2
- package/dist/theme/graph.css +5 -4
- package/dist/theme/graph.min.css +2 -2
- package/dist/theme/insight.css +5 -4
- package/dist/theme/insight.min.css +2 -2
- package/dist-esm/billboard.js +718 -509
- package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +3 -3
- package/dist-esm/plugin/billboardjs-plugin-sparkline.js +15 -9
- package/dist-esm/plugin/billboardjs-plugin-stanford.js +21 -28
- package/dist-esm/plugin/billboardjs-plugin-tableview.js +17 -11
- package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +13 -7
- package/package.json +32 -32
- package/src/Chart/api/axis.ts +4 -0
- package/src/Chart/api/category.ts +8 -4
- package/src/Chart/api/export.ts +1 -2
- package/src/Chart/api/subchart.ts +162 -89
- package/src/Chart/api/zoom.ts +69 -79
- package/src/ChartInternal/Axis/AxisRendererHelper.ts +0 -8
- package/src/ChartInternal/data/IData.ts +4 -1
- package/src/ChartInternal/data/convert.helper.ts +1 -15
- package/src/ChartInternal/data/data.ts +8 -2
- package/src/ChartInternal/interactions/eventrect.ts +3 -4
- package/src/ChartInternal/interactions/flow.ts +1 -7
- package/src/ChartInternal/interactions/interaction.ts +11 -5
- package/src/ChartInternal/interactions/subchart.ts +36 -30
- package/src/ChartInternal/interactions/zoom.ts +13 -3
- package/src/ChartInternal/internals/category.ts +2 -2
- package/src/ChartInternal/internals/clip.ts +4 -5
- package/src/ChartInternal/internals/color.ts +49 -23
- package/src/ChartInternal/internals/domain.ts +46 -10
- package/src/ChartInternal/internals/grid.ts +57 -86
- package/src/ChartInternal/internals/redraw.ts +1 -6
- package/src/ChartInternal/internals/region.ts +35 -12
- package/src/ChartInternal/internals/selection.ts +1 -1
- package/src/ChartInternal/internals/text.ts +1 -26
- package/src/ChartInternal/internals/title.ts +10 -48
- package/src/ChartInternal/internals/tooltip.ts +50 -54
- package/src/ChartInternal/shape/arc.ts +2 -2
- package/src/ChartInternal/shape/candlestick.ts +2 -17
- package/src/ChartInternal/shape/point.ts +36 -8
- package/src/ChartInternal/shape/radar.ts +1 -1
- package/src/ChartInternal/shape/shape.ts +50 -4
- package/src/ChartInternal/shape/treemap.ts +2 -2
- package/src/Plugin/bubblecompare/index.ts +1 -1
- package/src/Plugin/sparkline/index.ts +2 -2
- package/src/Plugin/stanford/Elements.ts +10 -2
- package/src/Plugin/stanford/index.ts +1 -24
- package/src/Plugin/tableview/index.ts +2 -2
- package/src/config/Options/axis/x.ts +1 -0
- package/src/config/Options/common/main.ts +12 -2
- package/src/config/Options/common/point.ts +41 -0
- package/src/config/Options/common/tooltip.ts +10 -10
- package/src/config/Options/data/axis.ts +3 -1
- package/src/config/Options/data/data.ts +10 -2
- package/src/config/Options/shape/area.ts +10 -4
- package/src/config/Options/shape/bar.ts +10 -4
- package/src/config/Store/State.ts +3 -0
- package/src/module/Cache.ts +7 -5
- package/src/module/browser.ts +34 -14
- package/src/module/util.ts +8 -4
- package/src/module/worker.ts +24 -13
- package/src/scss/billboard.scss +4 -2
- package/src/scss/theme/dark.scss +4 -2
- package/src/scss/theme/datalab.scss +4 -2
- package/src/scss/theme/graph.scss +4 -2
- package/src/scss/theme/insight.scss +4 -2
- package/types/chart.d.ts +11 -0
- package/types/options.d.ts +9 -3
- package/types/options.shape.d.ts +26 -0
- package/types/types.d.ts +15 -1
package/src/module/worker.ts
CHANGED
|
@@ -35,6 +35,24 @@ function getObjectURL(fn: Function, depsFn?: Function[]): string {
|
|
|
35
35
|
return window.URL.createObjectURL(blob[key]);
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
/**
|
|
39
|
+
* Get WebWorker instance
|
|
40
|
+
* @param {string} src URL object as string
|
|
41
|
+
* @returns {object} WebWorker instance
|
|
42
|
+
* @private
|
|
43
|
+
*/
|
|
44
|
+
function getWorker(src) {
|
|
45
|
+
const worker = new window.Worker(src);
|
|
46
|
+
|
|
47
|
+
// handle error
|
|
48
|
+
worker.onerror = function(e) {
|
|
49
|
+
// eslint-disable-next-line no-console
|
|
50
|
+
console.error ? console.error(e) : console.log(e);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
return worker;
|
|
54
|
+
}
|
|
55
|
+
|
|
38
56
|
/**
|
|
39
57
|
* Create and run on Web Worker
|
|
40
58
|
* @param {boolean} useWorker Use Web Worker
|
|
@@ -61,11 +79,15 @@ function getObjectURL(fn: Function, depsFn?: Function[]): string {
|
|
|
61
79
|
export function runWorker(
|
|
62
80
|
useWorker = true, fn: Function, callback: Function, depsFn?: Function[]
|
|
63
81
|
): Function {
|
|
64
|
-
let runFn
|
|
82
|
+
let runFn = function(...args) {
|
|
83
|
+
const res = fn(...args);
|
|
84
|
+
|
|
85
|
+
callback(res);
|
|
86
|
+
};
|
|
65
87
|
|
|
66
88
|
if (window.Worker && useWorker) {
|
|
67
89
|
const src = getObjectURL(fn, depsFn);
|
|
68
|
-
const worker =
|
|
90
|
+
const worker = getWorker(src);
|
|
69
91
|
|
|
70
92
|
runFn = function(...args) {
|
|
71
93
|
// trigger worker
|
|
@@ -79,22 +101,11 @@ export function runWorker(
|
|
|
79
101
|
return callback(e.data);
|
|
80
102
|
};
|
|
81
103
|
|
|
82
|
-
// handle error
|
|
83
|
-
worker.onerror = function(e) {
|
|
84
|
-
console.error(e);
|
|
85
|
-
};
|
|
86
|
-
|
|
87
104
|
// return new Promise((resolve, reject) => {
|
|
88
105
|
// worker.onmessage = ({data}) => resolve(data);
|
|
89
106
|
// worker.onerror = reject;
|
|
90
107
|
// });
|
|
91
108
|
};
|
|
92
|
-
} else {
|
|
93
|
-
runFn = function(...args) {
|
|
94
|
-
const res = fn(...args);
|
|
95
|
-
|
|
96
|
-
callback(res);
|
|
97
|
-
};
|
|
98
109
|
}
|
|
99
110
|
|
|
100
111
|
return runFn;
|
package/src/scss/billboard.scss
CHANGED
package/src/scss/theme/dark.scss
CHANGED
package/types/chart.d.ts
CHANGED
|
@@ -251,6 +251,12 @@ export interface Chart {
|
|
|
251
251
|
};
|
|
252
252
|
|
|
253
253
|
subchart: {
|
|
254
|
+
/**
|
|
255
|
+
* Select subchart by giving x domain range.
|
|
256
|
+
* @param domain If domain range is given, the subchart will be seleted to the given domain. If no argument is given, the current subchart selection domain will be returned.
|
|
257
|
+
*/
|
|
258
|
+
(domain?: Array<Date|number|string>): Array<Date|number>;
|
|
259
|
+
|
|
254
260
|
/**
|
|
255
261
|
* Hide generated subchart
|
|
256
262
|
* - **NOTE:** for ESM imports, needs to import 'subchart' exports and instantiate it by calling `subchart()`.
|
|
@@ -268,6 +274,11 @@ export interface Chart {
|
|
|
268
274
|
* - **NOTE:** for ESM imports, needs to import 'subchart' exports and instantiate it by calling `subchart()`.
|
|
269
275
|
*/
|
|
270
276
|
toggle(): void;
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* Reset subchart selection
|
|
280
|
+
*/
|
|
281
|
+
reset(): void;
|
|
271
282
|
};
|
|
272
283
|
|
|
273
284
|
tooltip: {
|
package/types/options.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
PieOptions,
|
|
19
19
|
PolarOptions,
|
|
20
20
|
RadarOptions,
|
|
21
|
+
RadialGradientOptions,
|
|
21
22
|
ScatterOptions,
|
|
22
23
|
SplineOptions,
|
|
23
24
|
TreemapOptions
|
|
@@ -646,14 +647,14 @@ export interface TooltipOptions {
|
|
|
646
647
|
/**
|
|
647
648
|
* Set x Axis index to be shown at the initialization.
|
|
648
649
|
*/
|
|
649
|
-
x?: number;
|
|
650
|
+
x?: number | string;
|
|
650
651
|
|
|
651
652
|
/**
|
|
652
653
|
* Set the position of tooltip at the initialization.
|
|
653
654
|
*/
|
|
654
655
|
position?: {
|
|
655
|
-
top?: string;
|
|
656
|
-
left?: string;
|
|
656
|
+
top?: number | string;
|
|
657
|
+
left?: number | string;
|
|
657
658
|
}
|
|
658
659
|
};
|
|
659
660
|
|
|
@@ -851,6 +852,11 @@ export interface PointOptions {
|
|
|
851
852
|
*/
|
|
852
853
|
opacity?: number | null;
|
|
853
854
|
|
|
855
|
+
/**
|
|
856
|
+
* Set the radial gradient on point.
|
|
857
|
+
*/
|
|
858
|
+
radialGradient?: RadialGradientOptions;
|
|
859
|
+
|
|
854
860
|
select?: {
|
|
855
861
|
/**
|
|
856
862
|
* The radius size of each point on selected.
|
package/types/options.shape.d.ts
CHANGED
|
@@ -709,6 +709,32 @@ export interface LinearGradientOptions {
|
|
|
709
709
|
stops?: Array<[number, string | null | ((this: Chart, id: string) => string), number]>;
|
|
710
710
|
}
|
|
711
711
|
|
|
712
|
+
export interface RadialGradientOptions {
|
|
713
|
+
/**
|
|
714
|
+
* cx attribute
|
|
715
|
+
*/
|
|
716
|
+
cx?: number;
|
|
717
|
+
|
|
718
|
+
/**
|
|
719
|
+
* cy attribute
|
|
720
|
+
*/
|
|
721
|
+
cy?: number;
|
|
722
|
+
|
|
723
|
+
/**
|
|
724
|
+
* r attribute
|
|
725
|
+
*/
|
|
726
|
+
r?: number;
|
|
727
|
+
|
|
728
|
+
/**
|
|
729
|
+
* The ramp of colors to use on a gradient
|
|
730
|
+
*
|
|
731
|
+
* offset, stop-color, stop-opacity
|
|
732
|
+
* - setting 'null' for stop-color, will set its original data color
|
|
733
|
+
* - setting 'function' for stop-color, will pass data id as argument. It should return color string or null value
|
|
734
|
+
*/
|
|
735
|
+
stops?: Array<[number, string | null | ((this: Chart, id: string) => string), number]>;
|
|
736
|
+
}
|
|
737
|
+
|
|
712
738
|
export interface TreemapOptions {
|
|
713
739
|
/**
|
|
714
740
|
* Treemap tile type
|
package/types/types.d.ts
CHANGED
|
@@ -54,7 +54,7 @@ export interface DataItem<T=number> {
|
|
|
54
54
|
|
|
55
55
|
export type DataArray = DataRow[];
|
|
56
56
|
|
|
57
|
-
export interface
|
|
57
|
+
export interface DataRegionsType {
|
|
58
58
|
[key: string]: {
|
|
59
59
|
start?: number;
|
|
60
60
|
end?: number;
|
|
@@ -63,3 +63,17 @@ export interface RegionsType {
|
|
|
63
63
|
}
|
|
64
64
|
};
|
|
65
65
|
}
|
|
66
|
+
|
|
67
|
+
export interface RegionsType {
|
|
68
|
+
axis?: "x" | "y" | "y2";
|
|
69
|
+
start?: number;
|
|
70
|
+
end?: number;
|
|
71
|
+
class?: string;
|
|
72
|
+
label?: {
|
|
73
|
+
text: string;
|
|
74
|
+
x?: number;
|
|
75
|
+
y?: number;
|
|
76
|
+
color?: string;
|
|
77
|
+
rotated?: boolean;
|
|
78
|
+
};
|
|
79
|
+
}
|