billboard.js 3.11.3 → 3.12.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 +1 -5
- package/dist/billboard.css +13 -1
- package/dist/billboard.js +19672 -24210
- package/dist/billboard.min.css +2 -2
- package/dist/billboard.min.js +26 -3
- package/dist/billboard.pkgd.js +24515 -30430
- package/dist/billboard.pkgd.min.js +33 -3
- package/dist/plugin/billboardjs-plugin-bubblecompare.js +77 -175
- package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -3
- package/dist/plugin/billboardjs-plugin-sparkline.js +429 -1134
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +4 -3
- package/dist/plugin/billboardjs-plugin-stanford.js +666 -1524
- package/dist/plugin/billboardjs-plugin-stanford.min.js +15 -3
- package/dist/plugin/billboardjs-plugin-tableview.js +503 -1175
- package/dist/plugin/billboardjs-plugin-tableview.min.js +30 -3
- package/dist/plugin/billboardjs-plugin-textoverlap.js +351 -1055
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +4 -3
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.js +1387 -1854
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.min.js +5 -3
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.js +2760 -3959
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +7 -3
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +3504 -5057
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +18 -3
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +2906 -4072
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +33 -3
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.js +3076 -4506
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.min.js +7 -3
- package/dist/theme/dark.css +12 -1
- package/dist/theme/dark.min.css +2 -2
- package/dist/theme/datalab.css +12 -1
- package/dist/theme/datalab.min.css +2 -2
- package/dist/theme/graph.css +12 -1
- package/dist/theme/graph.min.css +2 -2
- package/dist/theme/insight.css +12 -1
- package/dist/theme/insight.min.css +2 -2
- package/dist/theme/modern.css +12 -1
- package/dist/theme/modern.min.css +3 -4
- package/dist-esm/billboard.js +9297 -8527
- package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +20 -27
- package/dist-esm/plugin/billboardjs-plugin-sparkline.js +155 -149
- package/dist-esm/plugin/billboardjs-plugin-stanford.js +302 -289
- package/dist-esm/plugin/billboardjs-plugin-tableview.js +236 -236
- package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +41 -43
- package/package.json +29 -49
- package/src/Chart/api/axis.ts +6 -13
- package/src/Chart/api/chart.ts +12 -11
- package/src/Chart/api/data.ts +8 -7
- package/src/Chart/api/export.ts +28 -21
- package/src/Chart/api/flow.ts +4 -2
- package/src/Chart/api/grid.ts +1 -5
- package/src/Chart/api/load.ts +2 -2
- package/src/Chart/api/regions.ts +29 -5
- package/src/Chart/api/selection.ts +2 -2
- package/src/Chart/api/show.ts +2 -3
- package/src/Chart/api/subchart.ts +2 -2
- package/src/Chart/api/tooltip.ts +8 -9
- package/src/Chart/api/x.ts +2 -2
- package/src/Chart/api/zoom.ts +2 -2
- package/src/ChartInternal/Axis/Axis.ts +119 -44
- package/src/ChartInternal/Axis/AxisRenderer.ts +53 -38
- package/src/ChartInternal/Axis/AxisRendererHelper.ts +2 -2
- package/src/ChartInternal/ChartInternal.ts +87 -55
- package/src/ChartInternal/data/IData.ts +31 -31
- package/src/ChartInternal/data/convert.helper.ts +66 -68
- package/src/ChartInternal/data/convert.ts +11 -11
- package/src/ChartInternal/data/data.ts +51 -27
- package/src/ChartInternal/data/load.ts +7 -6
- package/src/ChartInternal/interactions/drag.ts +2 -1
- package/src/ChartInternal/interactions/eventrect.ts +84 -32
- package/src/ChartInternal/interactions/flow.ts +14 -4
- package/src/ChartInternal/interactions/interaction.ts +51 -22
- package/src/ChartInternal/interactions/subchart.ts +27 -25
- package/src/ChartInternal/interactions/zoom.ts +29 -18
- package/src/ChartInternal/internals/category.ts +1 -1
- package/src/ChartInternal/internals/class.ts +6 -6
- package/src/ChartInternal/internals/clip.ts +8 -4
- package/src/ChartInternal/internals/color.ts +70 -42
- package/src/ChartInternal/internals/domain.ts +59 -28
- package/src/ChartInternal/internals/format.ts +5 -5
- package/src/ChartInternal/internals/grid.ts +131 -47
- package/src/ChartInternal/internals/legend.ts +93 -61
- package/src/ChartInternal/internals/redraw.ts +6 -2
- package/src/ChartInternal/internals/region.ts +5 -3
- package/src/ChartInternal/internals/scale.ts +28 -15
- package/src/ChartInternal/internals/selection.ts +14 -13
- package/src/ChartInternal/internals/size.axis.ts +18 -10
- package/src/ChartInternal/internals/size.ts +98 -67
- package/src/ChartInternal/internals/style.ts +21 -19
- package/src/ChartInternal/internals/text.ts +79 -43
- package/src/ChartInternal/internals/title.ts +2 -2
- package/src/ChartInternal/internals/tooltip.ts +78 -32
- package/src/ChartInternal/internals/transform.ts +4 -4
- package/src/ChartInternal/internals/type.ts +17 -12
- package/src/ChartInternal/shape/arc.ts +78 -44
- package/src/ChartInternal/shape/area.ts +19 -22
- package/src/ChartInternal/shape/bar.ts +41 -31
- package/src/ChartInternal/shape/bubble.ts +5 -5
- package/src/ChartInternal/shape/candlestick.ts +15 -13
- package/src/ChartInternal/shape/funnel.ts +317 -0
- package/src/ChartInternal/shape/gauge.ts +16 -9
- package/src/ChartInternal/shape/line.ts +62 -46
- package/src/ChartInternal/shape/point.common.ts +1 -4
- package/src/ChartInternal/shape/point.ts +54 -34
- package/src/ChartInternal/shape/polar.ts +4 -2
- package/src/ChartInternal/shape/radar.ts +40 -22
- package/src/ChartInternal/shape/shape.ts +84 -58
- package/src/ChartInternal/shape/treemap.ts +31 -20
- package/src/Plugin/bubblecompare/index.ts +1 -3
- package/src/Plugin/sparkline/index.ts +3 -4
- package/src/Plugin/stanford/ColorScale.ts +3 -2
- package/src/Plugin/stanford/Elements.ts +15 -6
- package/src/Plugin/stanford/Options.ts +5 -5
- package/src/Plugin/stanford/index.ts +13 -9
- package/src/Plugin/tableview/Options.ts +1 -1
- package/src/Plugin/tableview/const.ts +1 -4
- package/src/Plugin/tableview/index.ts +11 -9
- package/src/Plugin/textoverlap/index.ts +4 -6
- package/src/config/Options/Options.ts +3 -3
- package/src/config/Options/axis/axis.ts +36 -0
- package/src/config/Options/axis/x.ts +34 -14
- package/src/config/Options/axis/y.ts +13 -13
- package/src/config/Options/axis/y2.ts +23 -10
- package/src/config/Options/common/color.ts +4 -4
- package/src/config/Options/common/grid.ts +4 -4
- package/src/config/Options/common/legend.ts +12 -13
- package/src/config/Options/common/main.ts +23 -23
- package/src/config/Options/common/point.ts +17 -18
- package/src/config/Options/common/title.ts +2 -2
- package/src/config/Options/common/tooltip.ts +13 -11
- package/src/config/Options/data/axis.ts +2 -2
- package/src/config/Options/data/data.ts +48 -45
- package/src/config/Options/interaction/interaction.ts +1 -1
- package/src/config/Options/interaction/subchart.ts +2 -2
- package/src/config/Options/interaction/zoom.ts +9 -9
- package/src/config/Options/shape/arc.ts +10 -13
- package/src/config/Options/shape/area.ts +5 -7
- package/src/config/Options/shape/bar.ts +8 -10
- package/src/config/Options/shape/bubble.ts +1 -1
- package/src/config/Options/shape/candlestick.ts +2 -2
- package/src/config/Options/shape/donut.ts +4 -4
- package/src/config/Options/shape/funnel.ts +38 -0
- package/src/config/Options/shape/gauge.ts +6 -6
- package/src/config/Options/shape/line.ts +3 -3
- package/src/config/Options/shape/pie.ts +5 -5
- package/src/config/Options/shape/polar.ts +3 -3
- package/src/config/Options/shape/radar.ts +2 -2
- package/src/config/Options/shape/scatter.ts +1 -1
- package/src/config/Options/shape/treemap.ts +1 -1
- package/src/config/Store/Element.ts +8 -5
- package/src/config/Store/State.ts +20 -13
- package/src/config/classes.ts +14 -4
- package/src/config/config.ts +1 -1
- package/src/config/const.ts +2 -0
- package/src/config/resolver/axis.ts +4 -4
- package/src/config/resolver/interaction.ts +3 -7
- package/src/config/resolver/shape.ts +17 -12
- package/src/core.ts +2 -3
- package/src/index.esm.ts +3 -6
- package/src/index.ts +2 -2
- package/src/module/Cache.ts +2 -3
- package/src/module/browser.ts +15 -10
- package/src/module/error.ts +9 -8
- package/src/module/generator.ts +3 -5
- package/src/module/util.ts +62 -39
- package/src/module/worker.ts +14 -11
- package/src/scss/billboard.scss +18 -0
- package/src/scss/theme/dark.scss +17 -0
- package/src/scss/theme/datalab.scss +17 -0
- package/src/scss/theme/graph.scss +17 -0
- package/src/scss/theme/insight.scss +17 -0
- package/src/scss/theme/modern.scss +17 -0
- package/types/axis.d.ts +17 -0
- package/types/bb.d.ts +1 -0
- package/types/index.d.ts +1 -0
- package/types/options.d.ts +9 -0
- package/types/options.shape.d.ts +26 -1
- package/types/types.d.ts +1 -0
package/src/module/browser.ts
CHANGED
|
@@ -7,20 +7,14 @@
|
|
|
7
7
|
* @private
|
|
8
8
|
*/
|
|
9
9
|
/* eslint-disable no-new-func, no-undef */
|
|
10
|
-
export {
|
|
11
|
-
win as window,
|
|
12
|
-
doc as document,
|
|
13
|
-
requestAnimationFrame, cancelAnimationFrame,
|
|
14
|
-
requestIdleCallback, cancelIdleCallback
|
|
15
|
-
};
|
|
16
|
-
|
|
17
10
|
/**
|
|
18
11
|
* Get global object
|
|
19
12
|
* @returns {object} window object
|
|
20
13
|
* @private
|
|
21
14
|
*/
|
|
22
15
|
function getGlobal() {
|
|
23
|
-
return (typeof globalThis === "object" && globalThis !== null && globalThis.Object === Object &&
|
|
16
|
+
return (typeof globalThis === "object" && globalThis !== null && globalThis.Object === Object &&
|
|
17
|
+
globalThis) ||
|
|
24
18
|
(typeof global === "object" && global !== null && global.Object === Object && global) ||
|
|
25
19
|
(typeof self === "object" && self !== null && self.Object === Object && self) ||
|
|
26
20
|
Function("return this")();
|
|
@@ -33,8 +27,10 @@ function getGlobal() {
|
|
|
33
27
|
* @private
|
|
34
28
|
*/
|
|
35
29
|
function getFallback(w) {
|
|
36
|
-
const hasRAF = typeof w?.requestAnimationFrame === "function" &&
|
|
37
|
-
|
|
30
|
+
const hasRAF = typeof w?.requestAnimationFrame === "function" &&
|
|
31
|
+
typeof w?.cancelAnimationFrame === "function";
|
|
32
|
+
const hasRIC = typeof w?.requestIdleCallback === "function" &&
|
|
33
|
+
typeof w?.cancelIdleCallback === "function";
|
|
38
34
|
const request = cb => setTimeout(cb, 1);
|
|
39
35
|
const cancel = id => clearTimeout(id);
|
|
40
36
|
|
|
@@ -55,3 +51,12 @@ const [
|
|
|
55
51
|
requestIdleCallback,
|
|
56
52
|
cancelIdleCallback
|
|
57
53
|
] = getFallback(win);
|
|
54
|
+
|
|
55
|
+
export {
|
|
56
|
+
cancelAnimationFrame,
|
|
57
|
+
cancelIdleCallback,
|
|
58
|
+
doc as document,
|
|
59
|
+
requestAnimationFrame,
|
|
60
|
+
requestIdleCallback,
|
|
61
|
+
win as window
|
|
62
|
+
};
|
package/src/module/error.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {window} from "./browser";
|
|
2
1
|
import {TYPE, TYPE_METHOD_NEEDED} from "../config/const";
|
|
2
|
+
import {window} from "./browser";
|
|
3
3
|
import {camelize, isEmpty} from "./util";
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -7,10 +7,7 @@ import {camelize, isEmpty} from "./util";
|
|
|
7
7
|
* billboard.js project is licensed under the MIT license
|
|
8
8
|
*/
|
|
9
9
|
/* eslint no-console: "off" */
|
|
10
|
-
export {
|
|
11
|
-
checkModuleImport,
|
|
12
|
-
logError
|
|
13
|
-
};
|
|
10
|
+
export {checkModuleImport, logError};
|
|
14
11
|
|
|
15
12
|
/**
|
|
16
13
|
* Check chart type module imports.
|
|
@@ -35,7 +32,9 @@ function checkModuleImport(ctx) {
|
|
|
35
32
|
}
|
|
36
33
|
}
|
|
37
34
|
|
|
38
|
-
type &&
|
|
35
|
+
type &&
|
|
36
|
+
logError(`Please, make sure if %c${camelize(type)}`,
|
|
37
|
+
"module has been imported and specified correctly.");
|
|
39
38
|
}
|
|
40
39
|
|
|
41
40
|
/**
|
|
@@ -46,11 +45,13 @@ function checkModuleImport(ctx) {
|
|
|
46
45
|
*/
|
|
47
46
|
function logError(head, tail) {
|
|
48
47
|
const prefix = "[billboard.js]";
|
|
49
|
-
const info =
|
|
48
|
+
const info =
|
|
49
|
+
"https://github.com/naver/billboard.js/wiki/CHANGELOG-v2#modularization-by-its-functionality";
|
|
50
50
|
const hasConsole = window.console?.error;
|
|
51
51
|
|
|
52
52
|
if (hasConsole) {
|
|
53
|
-
console.error(`❌ ${prefix} ${head}`,
|
|
53
|
+
console.error(`❌ ${prefix} ${head}`,
|
|
54
|
+
"background:red;color:white;display:block;font-size:15px", tail);
|
|
54
55
|
console.info("%cℹ️", "font-size:15px", info);
|
|
55
56
|
}
|
|
56
57
|
|
package/src/module/generator.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* billboard.js project is licensed under the MIT license
|
|
4
4
|
*/
|
|
5
5
|
import type {d3Transition} from "../../types/types";
|
|
6
|
-
import {
|
|
6
|
+
import {requestIdleCallback, window} from "./browser";
|
|
7
7
|
import {isArray, isNumber, isTabVisible, runUntil} from "./util";
|
|
8
8
|
|
|
9
9
|
const {setTimeout, clearTimeout} = window;
|
|
@@ -14,7 +14,7 @@ const {setTimeout, clearTimeout} = window;
|
|
|
14
14
|
* @returns {Fucntion}
|
|
15
15
|
* @private
|
|
16
16
|
*/
|
|
17
|
-
export function generateResize(option: boolean|number) {
|
|
17
|
+
export function generateResize(option: boolean | number) {
|
|
18
18
|
const fn: Function[] = [];
|
|
19
19
|
let timeout;
|
|
20
20
|
|
|
@@ -94,9 +94,7 @@ export function generateWait() {
|
|
|
94
94
|
};
|
|
95
95
|
|
|
96
96
|
f.add = function(t: Transition | Transition[]) {
|
|
97
|
-
isArray(t) ?
|
|
98
|
-
(transitionsToWait = transitionsToWait.concat(t)) :
|
|
99
|
-
transitionsToWait.push(t);
|
|
97
|
+
isArray(t) ? (transitionsToWait = transitionsToWait.concat(t)) : transitionsToWait.push(t);
|
|
100
98
|
};
|
|
101
99
|
|
|
102
100
|
return f;
|
package/src/module/util.ts
CHANGED
|
@@ -3,28 +3,28 @@
|
|
|
3
3
|
* billboard.js project is licensed under the MIT license
|
|
4
4
|
* @ignore
|
|
5
5
|
*/
|
|
6
|
-
import {pointer as d3Pointer} from "d3-selection";
|
|
7
6
|
import {brushSelection as d3BrushSelection} from "d3-brush";
|
|
7
|
+
import {pointer as d3Pointer} from "d3-selection";
|
|
8
8
|
import type {d3Selection} from "../../types/types";
|
|
9
|
-
import {document,
|
|
9
|
+
import {document, requestAnimationFrame, window} from "./browser";
|
|
10
10
|
|
|
11
11
|
export {
|
|
12
12
|
addCssRules,
|
|
13
13
|
asHalfPixel,
|
|
14
14
|
brushEmpty,
|
|
15
15
|
callFn,
|
|
16
|
-
capitalize,
|
|
17
16
|
camelize,
|
|
17
|
+
capitalize,
|
|
18
18
|
ceil10,
|
|
19
19
|
convertInputType,
|
|
20
20
|
deepClone,
|
|
21
21
|
diffDomain,
|
|
22
|
-
endall,
|
|
23
22
|
emulateEvent,
|
|
23
|
+
endall,
|
|
24
24
|
extend,
|
|
25
25
|
findIndex,
|
|
26
|
-
getBrushSelection,
|
|
27
26
|
getBoundingRect,
|
|
27
|
+
getBrushSelection,
|
|
28
28
|
getCssRules,
|
|
29
29
|
getMinMax,
|
|
30
30
|
getOption,
|
|
@@ -38,7 +38,7 @@ export {
|
|
|
38
38
|
getUnique,
|
|
39
39
|
hasValue,
|
|
40
40
|
isArray,
|
|
41
|
-
|
|
41
|
+
isBoolean,
|
|
42
42
|
isDefined,
|
|
43
43
|
isEmpty,
|
|
44
44
|
isFunction,
|
|
@@ -62,12 +62,12 @@ export {
|
|
|
62
62
|
};
|
|
63
63
|
|
|
64
64
|
const isValue = (v: any): boolean => v || v === 0;
|
|
65
|
-
const isFunction = (v: unknown): v is (
|
|
65
|
+
const isFunction = (v: unknown): v is (...args: any[]) => any => typeof v === "function";
|
|
66
66
|
const isString = (v: unknown): v is string => typeof v === "string";
|
|
67
67
|
const isNumber = (v: unknown): v is number => typeof v === "number";
|
|
68
68
|
const isUndefined = (v: unknown): v is undefined => typeof v === "undefined";
|
|
69
69
|
const isDefined = (v: unknown): boolean => typeof v !== "undefined";
|
|
70
|
-
const
|
|
70
|
+
const isBoolean = (v: unknown): boolean => typeof v === "boolean";
|
|
71
71
|
const ceil10 = (v: number): number => Math.ceil(v / 10) * 10;
|
|
72
72
|
const asHalfPixel = (n: number): number => Math.ceil(n) + 0.5;
|
|
73
73
|
const diffDomain = (d: number[]): number => d[1] - d[0];
|
|
@@ -171,7 +171,8 @@ function endall(transition, cb: Function): void {
|
|
|
171
171
|
*/
|
|
172
172
|
function sanitize(str: string): string {
|
|
173
173
|
return isString(str) ?
|
|
174
|
-
str.replace(/<(script|img)?/ig, "<").replace(/(script)?>/ig, ">") :
|
|
174
|
+
str.replace(/<(script|img)?/ig, "<").replace(/(script)?>/ig, ">") :
|
|
175
|
+
str;
|
|
175
176
|
}
|
|
176
177
|
|
|
177
178
|
/**
|
|
@@ -227,7 +228,7 @@ function getRectSegList(path: SVGGraphicsElement): {x: number, y: number}[] {
|
|
|
227
228
|
* | |
|
|
228
229
|
* | |
|
|
229
230
|
* seg0 ---------- seg3
|
|
230
|
-
|
|
231
|
+
*/
|
|
231
232
|
const {x, y, width, height} = path.getBBox();
|
|
232
233
|
|
|
233
234
|
return [
|
|
@@ -253,11 +254,13 @@ function getPathBox(
|
|
|
253
254
|
const y = Math.min(items[0].y, items[1].y);
|
|
254
255
|
|
|
255
256
|
return {
|
|
256
|
-
x,
|
|
257
|
+
x,
|
|
258
|
+
y,
|
|
259
|
+
width,
|
|
260
|
+
height
|
|
257
261
|
};
|
|
258
262
|
}
|
|
259
263
|
|
|
260
|
-
|
|
261
264
|
/**
|
|
262
265
|
* Get event's current position coordinates
|
|
263
266
|
* @param {object} event Event object
|
|
@@ -266,7 +269,8 @@ function getPathBox(
|
|
|
266
269
|
* @private
|
|
267
270
|
*/
|
|
268
271
|
function getPointer(event, element?: Element): number[] {
|
|
269
|
-
const touches = event &&
|
|
272
|
+
const touches = event &&
|
|
273
|
+
(event.touches || (event.sourceEvent && event.sourceEvent.touches))?.[0];
|
|
270
274
|
let pointer = [0, 0];
|
|
271
275
|
|
|
272
276
|
try {
|
|
@@ -290,7 +294,7 @@ function getBrushSelection(ctx) {
|
|
|
290
294
|
// check from event
|
|
291
295
|
if (event && event.type === "brush") {
|
|
292
296
|
selection = event.selection;
|
|
293
|
-
|
|
297
|
+
// check from brush area selection
|
|
294
298
|
} else if (main && (selection = main.select(".bb-brush").node())) {
|
|
295
299
|
selection = d3BrushSelection(selection);
|
|
296
300
|
}
|
|
@@ -305,16 +309,24 @@ function getBrushSelection(ctx) {
|
|
|
305
309
|
* @returns {object}
|
|
306
310
|
* @private
|
|
307
311
|
*/
|
|
308
|
-
function getBoundingRect(
|
|
309
|
-
|
|
310
|
-
|
|
312
|
+
function getBoundingRect(
|
|
313
|
+
node
|
|
314
|
+
): {
|
|
315
|
+
left: number,
|
|
316
|
+
top: number,
|
|
317
|
+
right: number,
|
|
318
|
+
bottom: number,
|
|
319
|
+
x: number,
|
|
320
|
+
y: number,
|
|
321
|
+
width: number,
|
|
322
|
+
height: number
|
|
311
323
|
} {
|
|
312
324
|
const needEvaluate = !("rect" in node) || (
|
|
313
|
-
"rect" in node && node.hasAttribute("width") &&
|
|
325
|
+
"rect" in node && node.hasAttribute("width") &&
|
|
326
|
+
node.rect.width !== +node.getAttribute("width")
|
|
314
327
|
);
|
|
315
328
|
|
|
316
|
-
return needEvaluate ?
|
|
317
|
-
(node.rect = node.getBoundingClientRect()) : node.rect;
|
|
329
|
+
return needEvaluate ? (node.rect = node.getBoundingClientRect()) : node.rect;
|
|
318
330
|
}
|
|
319
331
|
|
|
320
332
|
/**
|
|
@@ -444,7 +456,6 @@ function extend(target = {}, source): object {
|
|
|
444
456
|
*/
|
|
445
457
|
const capitalize = (str: string): string => str.charAt(0).toUpperCase() + str.slice(1);
|
|
446
458
|
|
|
447
|
-
|
|
448
459
|
/**
|
|
449
460
|
* Camelize from kebob style string
|
|
450
461
|
* @param {string} str Target string
|
|
@@ -478,9 +489,10 @@ const toArray = (v: CSSStyleDeclaration | any): any => [].slice.call(v);
|
|
|
478
489
|
*/
|
|
479
490
|
function addCssRules(style, selector: string, prop: string[]): number {
|
|
480
491
|
const {rootSelector = "", sheet} = style;
|
|
481
|
-
const getSelector = s =>
|
|
482
|
-
|
|
483
|
-
|
|
492
|
+
const getSelector = s =>
|
|
493
|
+
s
|
|
494
|
+
.replace(/\s?(bb-)/g, ".$1")
|
|
495
|
+
.replace(/\.+/g, ".");
|
|
484
496
|
|
|
485
497
|
const rule = `${rootSelector} ${getSelector(selector)} {${prop.join(";")}}`;
|
|
486
498
|
|
|
@@ -586,8 +598,7 @@ function mergeObj(target: object, ...objectN): any {
|
|
|
586
598
|
!target[key] && (target[key] = {});
|
|
587
599
|
target[key] = mergeObj(target[key], value);
|
|
588
600
|
} else {
|
|
589
|
-
target[key] = isArray(value) ?
|
|
590
|
-
value.concat() : value;
|
|
601
|
+
target[key] = isArray(value) ? value.concat() : value;
|
|
591
602
|
}
|
|
592
603
|
});
|
|
593
604
|
}
|
|
@@ -625,7 +636,8 @@ function sortValue(data: any[], isAsc = true): any[] {
|
|
|
625
636
|
* @returns {number|Date|undefined}
|
|
626
637
|
* @private
|
|
627
638
|
*/
|
|
628
|
-
function getMinMax(type: "min" | "max", data: number[] | Date[] | any): number | Date | undefined
|
|
639
|
+
function getMinMax(type: "min" | "max", data: number[] | Date[] | any): number | Date | undefined
|
|
640
|
+
| any {
|
|
629
641
|
let res = data.filter(v => notEmpty(v));
|
|
630
642
|
|
|
631
643
|
if (res.length) {
|
|
@@ -664,7 +676,12 @@ const getRange = (start: number, end: number, step = 1): number[] => {
|
|
|
664
676
|
const emulateEvent = {
|
|
665
677
|
mouse: (() => {
|
|
666
678
|
const getParams = () => ({
|
|
667
|
-
bubbles: false,
|
|
679
|
+
bubbles: false,
|
|
680
|
+
cancelable: false,
|
|
681
|
+
screenX: 0,
|
|
682
|
+
screenY: 0,
|
|
683
|
+
clientX: 0,
|
|
684
|
+
clientY: 0
|
|
668
685
|
});
|
|
669
686
|
|
|
670
687
|
try {
|
|
@@ -686,9 +703,16 @@ const emulateEvent = {
|
|
|
686
703
|
params.cancelable,
|
|
687
704
|
window,
|
|
688
705
|
0, // the event's mouse click count
|
|
689
|
-
params.screenX,
|
|
690
|
-
params.
|
|
691
|
-
|
|
706
|
+
params.screenX,
|
|
707
|
+
params.screenY,
|
|
708
|
+
params.clientX,
|
|
709
|
+
params.clientY,
|
|
710
|
+
false,
|
|
711
|
+
false,
|
|
712
|
+
false,
|
|
713
|
+
false,
|
|
714
|
+
0,
|
|
715
|
+
null
|
|
692
716
|
);
|
|
693
717
|
|
|
694
718
|
el.dispatchEvent(mouseEvent);
|
|
@@ -788,9 +812,11 @@ function convertInputType(mouse: boolean, touch: boolean): "mouse" | "touch" | n
|
|
|
788
812
|
if (navigator && "maxTouchPoints" in navigator) {
|
|
789
813
|
hasTouch = navigator.maxTouchPoints > 0;
|
|
790
814
|
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
} else if (
|
|
815
|
+
// Ref: https://github.com/Modernizr/Modernizr/blob/master/feature-detects/touchevents.js
|
|
816
|
+
// On IE11 with IE9 emulation mode, ('ontouchstart' in window) is returning true
|
|
817
|
+
} else if (
|
|
818
|
+
"ontouchmove" in window || (DocumentTouch && document instanceof DocumentTouch)
|
|
819
|
+
) {
|
|
794
820
|
hasTouch = true;
|
|
795
821
|
} else {
|
|
796
822
|
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Browser_detection_using_the_user_agent#avoiding_user_agent_detection
|
|
@@ -800,10 +826,8 @@ function convertInputType(mouse: boolean, touch: boolean): "mouse" | "touch" | n
|
|
|
800
826
|
// Only as a last resort, fall back to user agent sniffing
|
|
801
827
|
const UA = navigator.userAgent;
|
|
802
828
|
|
|
803
|
-
hasTouch = (
|
|
804
|
-
/\b(
|
|
805
|
-
/\b(Android|Windows Phone|iPad|iPod)\b/i.test(UA)
|
|
806
|
-
);
|
|
829
|
+
hasTouch = /\b(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(UA) ||
|
|
830
|
+
/\b(Android|Windows Phone|iPad|iPod)\b/i.test(UA);
|
|
807
831
|
}
|
|
808
832
|
}
|
|
809
833
|
}
|
|
@@ -831,4 +855,3 @@ function runUntil(fn: Function, conditionFn: Function): void {
|
|
|
831
855
|
fn();
|
|
832
856
|
}
|
|
833
857
|
}
|
|
834
|
-
|
package/src/module/worker.ts
CHANGED
|
@@ -62,22 +62,25 @@ function getWorker(src) {
|
|
|
62
62
|
* @returns {object}
|
|
63
63
|
* @example
|
|
64
64
|
* const worker = runWorker(function(arg) {
|
|
65
|
-
*
|
|
66
|
-
*
|
|
65
|
+
* // do some tasks...
|
|
66
|
+
* console.log("param:", A(arg));
|
|
67
67
|
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
68
|
+
* return 1234;
|
|
69
|
+
* }, function(data) {
|
|
70
|
+
* // callback after worker is done
|
|
71
|
+
* console.log("result:", data);
|
|
72
|
+
* },
|
|
73
|
+
* [function A(){}]
|
|
74
|
+
* );
|
|
75
75
|
*
|
|
76
|
-
*
|
|
76
|
+
* worker(11111);
|
|
77
77
|
* @private
|
|
78
78
|
*/
|
|
79
79
|
export function runWorker(
|
|
80
|
-
useWorker = true,
|
|
80
|
+
useWorker = true,
|
|
81
|
+
fn: Function,
|
|
82
|
+
callback: Function,
|
|
83
|
+
depsFn?: Function[]
|
|
81
84
|
): Function {
|
|
82
85
|
let runFn = function(...args) {
|
|
83
86
|
const res = fn(...args);
|
package/src/scss/billboard.scss
CHANGED
|
@@ -50,9 +50,27 @@
|
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
/*-- Funnel --*/
|
|
54
|
+
.bb-chart-funnels {
|
|
55
|
+
path {
|
|
56
|
+
stroke-width: 0;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
+ .bb-chart-texts text {
|
|
60
|
+
font-size: 13px;
|
|
61
|
+
fill: #fff;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
53
65
|
/*-- Axis --*/
|
|
54
66
|
.bb-axis {
|
|
55
67
|
shape-rendering: crispEdges;
|
|
68
|
+
|
|
69
|
+
.bb-axis-x-tooltip, .bb-axis-y-tooltip, .bb-axis-y2-tooltip {
|
|
70
|
+
font-size: 1em;
|
|
71
|
+
fill: #fff;
|
|
72
|
+
white-space: nowrap;
|
|
73
|
+
}
|
|
56
74
|
}
|
|
57
75
|
|
|
58
76
|
/*-- Grid --*/
|
package/src/scss/theme/dark.scss
CHANGED
|
@@ -45,9 +45,26 @@ $font-family: Helvetica, Arial, sans-serif, "nanumgothic", "Dotum";
|
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
/*-- Funnel --*/
|
|
49
|
+
.bb-chart-funnels {
|
|
50
|
+
path {
|
|
51
|
+
stroke-width: 0;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
+ .bb-chart-texts text {
|
|
55
|
+
fill: #fff;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
48
59
|
/*-- Axis --*/
|
|
49
60
|
.bb-axis {
|
|
50
61
|
shape-rendering: crispEdges;
|
|
62
|
+
|
|
63
|
+
.bb-axis-x-tooltip, .bb-axis-y-tooltip, .bb-axis-y2-tooltip {
|
|
64
|
+
font-size: 0.9em;
|
|
65
|
+
fill: #fff;
|
|
66
|
+
white-space: nowrap;
|
|
67
|
+
}
|
|
51
68
|
}
|
|
52
69
|
|
|
53
70
|
.bb-axis-y text, .bb-axis-y2 text {
|
|
@@ -40,9 +40,26 @@ $text-font-size: 11px;
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
/*-- Funnel --*/
|
|
44
|
+
.bb-chart-funnels {
|
|
45
|
+
path {
|
|
46
|
+
stroke-width: 0;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
+ .bb-chart-texts text {
|
|
50
|
+
fill: #fff;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
43
54
|
/*-- Axis --*/
|
|
44
55
|
.bb-axis {
|
|
45
56
|
stroke-width: $line-stroke-widdth;
|
|
57
|
+
|
|
58
|
+
.bb-axis-x-tooltip, .bb-axis-y-tooltip, .bb-axis-y2-tooltip {
|
|
59
|
+
font-size: 0.9em;
|
|
60
|
+
fill: #fff;
|
|
61
|
+
white-space: nowrap;
|
|
62
|
+
}
|
|
46
63
|
}
|
|
47
64
|
|
|
48
65
|
.bb-axis-y text, .bb-axis-y2 text {
|
|
@@ -48,9 +48,26 @@ $axis-color: #8c8c8c;
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
/*-- Funnel --*/
|
|
52
|
+
.bb-chart-funnels {
|
|
53
|
+
path {
|
|
54
|
+
stroke-width: 0;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
+ .bb-chart-texts text {
|
|
58
|
+
fill: #fff;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
51
62
|
/*-- Axis --*/
|
|
52
63
|
.bb-axis {
|
|
53
64
|
shape-rendering: crispEdges;
|
|
65
|
+
|
|
66
|
+
.bb-axis-x-tooltip, .bb-axis-y-tooltip, .bb-axis-y2-tooltip {
|
|
67
|
+
font-size: 0.9em;
|
|
68
|
+
fill: #fff;
|
|
69
|
+
white-space: nowrap;
|
|
70
|
+
}
|
|
54
71
|
}
|
|
55
72
|
|
|
56
73
|
.bb-axis-y text, .bb-axis-y2 text {
|
|
@@ -43,9 +43,26 @@ $font-family: sans-serif, Arial, "nanumgothic", "Dotum";
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
/*-- Funnel --*/
|
|
47
|
+
.bb-chart-funnels {
|
|
48
|
+
path {
|
|
49
|
+
stroke-width: 0;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
+ .bb-chart-texts text {
|
|
53
|
+
fill: #fff;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
46
57
|
/*-- Axis --*/
|
|
47
58
|
.bb-axis {
|
|
48
59
|
shape-rendering: crispEdges;
|
|
60
|
+
|
|
61
|
+
.bb-axis-x-tooltip, .bb-axis-y-tooltip, .bb-axis-y2-tooltip {
|
|
62
|
+
font-size: 0.9em;
|
|
63
|
+
fill: #fff;
|
|
64
|
+
white-space: nowrap;
|
|
65
|
+
}
|
|
49
66
|
}
|
|
50
67
|
|
|
51
68
|
.bb-axis-y text, .bb-axis-y2 text {
|
|
@@ -46,9 +46,26 @@ $button-bg: #404244;
|
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
+
/*-- Funnel --*/
|
|
50
|
+
.bb-chart-funnels {
|
|
51
|
+
path {
|
|
52
|
+
stroke-width: 0;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
+ .bb-chart-texts text {
|
|
56
|
+
fill: #fff;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
49
60
|
/*-- Axis --*/
|
|
50
61
|
.bb-axis {
|
|
51
62
|
shape-rendering: crispEdges;
|
|
63
|
+
|
|
64
|
+
.bb-axis-x-tooltip, .bb-axis-y-tooltip, .bb-axis-y2-tooltip {
|
|
65
|
+
font-size: 0.9em;
|
|
66
|
+
fill: #fff;
|
|
67
|
+
white-space: nowrap;
|
|
68
|
+
}
|
|
52
69
|
}
|
|
53
70
|
|
|
54
71
|
.bb-axis-y text, .bb-axis-y2 text {
|
package/types/axis.d.ts
CHANGED
|
@@ -9,6 +9,13 @@ export interface Axis {
|
|
|
9
9
|
* Switch x and y axis position.
|
|
10
10
|
*/
|
|
11
11
|
rotated?: boolean;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Set axis tooltip.
|
|
15
|
+
*/
|
|
16
|
+
tooltip?: boolean | {
|
|
17
|
+
backgroundColor?: string | {x?: string; y?: string; y2?: string}
|
|
18
|
+
};
|
|
12
19
|
x?: xAxisConfiguration;
|
|
13
20
|
y?: yAxisConfiguration;
|
|
14
21
|
y2?: yAxisConfigurationBase;
|
|
@@ -43,6 +50,16 @@ export interface xAxisConfiguration extends AxisConfigurationBase {
|
|
|
43
50
|
*/
|
|
44
51
|
type?: "category" | "indexed" | "log" | "timeseries";
|
|
45
52
|
|
|
53
|
+
/**
|
|
54
|
+
* Force the x axis to interact as single rather than multiple x axes.
|
|
55
|
+
* - NOTE: The tooltip event will be triggered nearing each data points(for multiple xs) rather than x axis based(as single x does) in below condition:
|
|
56
|
+
* - for `bubble` & `scatter` type
|
|
57
|
+
* - when `data.xs` is set
|
|
58
|
+
* - when `tooltip.grouped=false` is set
|
|
59
|
+
* - `tooltip.grouped` options will take precedence over `axis.forceSingleX` option.
|
|
60
|
+
*/
|
|
61
|
+
forceAsSingle?: boolean;
|
|
62
|
+
|
|
46
63
|
/**
|
|
47
64
|
* Set how to treat the timezone of x values.
|
|
48
65
|
* If true, treat x value as localtime. If false, convert to UTC internally.
|
package/types/bb.d.ts
CHANGED
|
@@ -42,6 +42,7 @@ export function bar(): "bar";
|
|
|
42
42
|
export function bubble(): "bubble";
|
|
43
43
|
export function candlestick(): "candlestick";
|
|
44
44
|
export function donut(): "donut";
|
|
45
|
+
export function funnel(): "funnel";
|
|
45
46
|
export function gauge(): "gauge";
|
|
46
47
|
export function line(): "line";
|
|
47
48
|
export function pie(): "pie";
|
package/types/index.d.ts
CHANGED
package/types/options.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
BubbleOptions,
|
|
14
14
|
CandlestickOptions,
|
|
15
15
|
DonutOptions,
|
|
16
|
+
FunnelOptions,
|
|
16
17
|
GaugeOptions,
|
|
17
18
|
LineOptions,
|
|
18
19
|
PieOptions,
|
|
@@ -285,6 +286,7 @@ export interface ChartOptions {
|
|
|
285
286
|
bubble?: BubbleOptions;
|
|
286
287
|
candlestick?: CandlestickOptions;
|
|
287
288
|
donut?: DonutOptions;
|
|
289
|
+
funnel?: FunnelOptions;
|
|
288
290
|
gauge?: GaugeOptions;
|
|
289
291
|
line?: LineOptions;
|
|
290
292
|
polar?: PolarOptions;
|
|
@@ -408,6 +410,13 @@ export interface RegionOptions {
|
|
|
408
410
|
start?: string | number | Date;
|
|
409
411
|
end?: string | number | Date;
|
|
410
412
|
class?: string;
|
|
413
|
+
label?: {
|
|
414
|
+
text?: string;
|
|
415
|
+
x?: number;
|
|
416
|
+
y?: number;
|
|
417
|
+
color?: string;
|
|
418
|
+
rotated?: boolean;
|
|
419
|
+
}
|
|
411
420
|
}
|
|
412
421
|
|
|
413
422
|
export interface LegendOptions {
|