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.
Files changed (177) hide show
  1. package/README.md +1 -5
  2. package/dist/billboard.css +13 -1
  3. package/dist/billboard.js +19672 -24210
  4. package/dist/billboard.min.css +2 -2
  5. package/dist/billboard.min.js +26 -3
  6. package/dist/billboard.pkgd.js +24515 -30430
  7. package/dist/billboard.pkgd.min.js +33 -3
  8. package/dist/plugin/billboardjs-plugin-bubblecompare.js +77 -175
  9. package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -3
  10. package/dist/plugin/billboardjs-plugin-sparkline.js +429 -1134
  11. package/dist/plugin/billboardjs-plugin-sparkline.min.js +4 -3
  12. package/dist/plugin/billboardjs-plugin-stanford.js +666 -1524
  13. package/dist/plugin/billboardjs-plugin-stanford.min.js +15 -3
  14. package/dist/plugin/billboardjs-plugin-tableview.js +503 -1175
  15. package/dist/plugin/billboardjs-plugin-tableview.min.js +30 -3
  16. package/dist/plugin/billboardjs-plugin-textoverlap.js +351 -1055
  17. package/dist/plugin/billboardjs-plugin-textoverlap.min.js +4 -3
  18. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.js +1387 -1854
  19. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.min.js +5 -3
  20. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.js +2760 -3959
  21. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +7 -3
  22. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +3504 -5057
  23. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +18 -3
  24. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +2906 -4072
  25. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +33 -3
  26. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.js +3076 -4506
  27. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.min.js +7 -3
  28. package/dist/theme/dark.css +12 -1
  29. package/dist/theme/dark.min.css +2 -2
  30. package/dist/theme/datalab.css +12 -1
  31. package/dist/theme/datalab.min.css +2 -2
  32. package/dist/theme/graph.css +12 -1
  33. package/dist/theme/graph.min.css +2 -2
  34. package/dist/theme/insight.css +12 -1
  35. package/dist/theme/insight.min.css +2 -2
  36. package/dist/theme/modern.css +12 -1
  37. package/dist/theme/modern.min.css +3 -4
  38. package/dist-esm/billboard.js +9297 -8527
  39. package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +20 -27
  40. package/dist-esm/plugin/billboardjs-plugin-sparkline.js +155 -149
  41. package/dist-esm/plugin/billboardjs-plugin-stanford.js +302 -289
  42. package/dist-esm/plugin/billboardjs-plugin-tableview.js +236 -236
  43. package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +41 -43
  44. package/package.json +29 -49
  45. package/src/Chart/api/axis.ts +6 -13
  46. package/src/Chart/api/chart.ts +12 -11
  47. package/src/Chart/api/data.ts +8 -7
  48. package/src/Chart/api/export.ts +28 -21
  49. package/src/Chart/api/flow.ts +4 -2
  50. package/src/Chart/api/grid.ts +1 -5
  51. package/src/Chart/api/load.ts +2 -2
  52. package/src/Chart/api/regions.ts +29 -5
  53. package/src/Chart/api/selection.ts +2 -2
  54. package/src/Chart/api/show.ts +2 -3
  55. package/src/Chart/api/subchart.ts +2 -2
  56. package/src/Chart/api/tooltip.ts +8 -9
  57. package/src/Chart/api/x.ts +2 -2
  58. package/src/Chart/api/zoom.ts +2 -2
  59. package/src/ChartInternal/Axis/Axis.ts +119 -44
  60. package/src/ChartInternal/Axis/AxisRenderer.ts +53 -38
  61. package/src/ChartInternal/Axis/AxisRendererHelper.ts +2 -2
  62. package/src/ChartInternal/ChartInternal.ts +87 -55
  63. package/src/ChartInternal/data/IData.ts +31 -31
  64. package/src/ChartInternal/data/convert.helper.ts +66 -68
  65. package/src/ChartInternal/data/convert.ts +11 -11
  66. package/src/ChartInternal/data/data.ts +51 -27
  67. package/src/ChartInternal/data/load.ts +7 -6
  68. package/src/ChartInternal/interactions/drag.ts +2 -1
  69. package/src/ChartInternal/interactions/eventrect.ts +84 -32
  70. package/src/ChartInternal/interactions/flow.ts +14 -4
  71. package/src/ChartInternal/interactions/interaction.ts +51 -22
  72. package/src/ChartInternal/interactions/subchart.ts +27 -25
  73. package/src/ChartInternal/interactions/zoom.ts +29 -18
  74. package/src/ChartInternal/internals/category.ts +1 -1
  75. package/src/ChartInternal/internals/class.ts +6 -6
  76. package/src/ChartInternal/internals/clip.ts +8 -4
  77. package/src/ChartInternal/internals/color.ts +70 -42
  78. package/src/ChartInternal/internals/domain.ts +59 -28
  79. package/src/ChartInternal/internals/format.ts +5 -5
  80. package/src/ChartInternal/internals/grid.ts +131 -47
  81. package/src/ChartInternal/internals/legend.ts +93 -61
  82. package/src/ChartInternal/internals/redraw.ts +6 -2
  83. package/src/ChartInternal/internals/region.ts +5 -3
  84. package/src/ChartInternal/internals/scale.ts +28 -15
  85. package/src/ChartInternal/internals/selection.ts +14 -13
  86. package/src/ChartInternal/internals/size.axis.ts +18 -10
  87. package/src/ChartInternal/internals/size.ts +98 -67
  88. package/src/ChartInternal/internals/style.ts +21 -19
  89. package/src/ChartInternal/internals/text.ts +79 -43
  90. package/src/ChartInternal/internals/title.ts +2 -2
  91. package/src/ChartInternal/internals/tooltip.ts +78 -32
  92. package/src/ChartInternal/internals/transform.ts +4 -4
  93. package/src/ChartInternal/internals/type.ts +17 -12
  94. package/src/ChartInternal/shape/arc.ts +78 -44
  95. package/src/ChartInternal/shape/area.ts +19 -22
  96. package/src/ChartInternal/shape/bar.ts +41 -31
  97. package/src/ChartInternal/shape/bubble.ts +5 -5
  98. package/src/ChartInternal/shape/candlestick.ts +15 -13
  99. package/src/ChartInternal/shape/funnel.ts +317 -0
  100. package/src/ChartInternal/shape/gauge.ts +16 -9
  101. package/src/ChartInternal/shape/line.ts +62 -46
  102. package/src/ChartInternal/shape/point.common.ts +1 -4
  103. package/src/ChartInternal/shape/point.ts +54 -34
  104. package/src/ChartInternal/shape/polar.ts +4 -2
  105. package/src/ChartInternal/shape/radar.ts +40 -22
  106. package/src/ChartInternal/shape/shape.ts +84 -58
  107. package/src/ChartInternal/shape/treemap.ts +31 -20
  108. package/src/Plugin/bubblecompare/index.ts +1 -3
  109. package/src/Plugin/sparkline/index.ts +3 -4
  110. package/src/Plugin/stanford/ColorScale.ts +3 -2
  111. package/src/Plugin/stanford/Elements.ts +15 -6
  112. package/src/Plugin/stanford/Options.ts +5 -5
  113. package/src/Plugin/stanford/index.ts +13 -9
  114. package/src/Plugin/tableview/Options.ts +1 -1
  115. package/src/Plugin/tableview/const.ts +1 -4
  116. package/src/Plugin/tableview/index.ts +11 -9
  117. package/src/Plugin/textoverlap/index.ts +4 -6
  118. package/src/config/Options/Options.ts +3 -3
  119. package/src/config/Options/axis/axis.ts +36 -0
  120. package/src/config/Options/axis/x.ts +34 -14
  121. package/src/config/Options/axis/y.ts +13 -13
  122. package/src/config/Options/axis/y2.ts +23 -10
  123. package/src/config/Options/common/color.ts +4 -4
  124. package/src/config/Options/common/grid.ts +4 -4
  125. package/src/config/Options/common/legend.ts +12 -13
  126. package/src/config/Options/common/main.ts +23 -23
  127. package/src/config/Options/common/point.ts +17 -18
  128. package/src/config/Options/common/title.ts +2 -2
  129. package/src/config/Options/common/tooltip.ts +13 -11
  130. package/src/config/Options/data/axis.ts +2 -2
  131. package/src/config/Options/data/data.ts +48 -45
  132. package/src/config/Options/interaction/interaction.ts +1 -1
  133. package/src/config/Options/interaction/subchart.ts +2 -2
  134. package/src/config/Options/interaction/zoom.ts +9 -9
  135. package/src/config/Options/shape/arc.ts +10 -13
  136. package/src/config/Options/shape/area.ts +5 -7
  137. package/src/config/Options/shape/bar.ts +8 -10
  138. package/src/config/Options/shape/bubble.ts +1 -1
  139. package/src/config/Options/shape/candlestick.ts +2 -2
  140. package/src/config/Options/shape/donut.ts +4 -4
  141. package/src/config/Options/shape/funnel.ts +38 -0
  142. package/src/config/Options/shape/gauge.ts +6 -6
  143. package/src/config/Options/shape/line.ts +3 -3
  144. package/src/config/Options/shape/pie.ts +5 -5
  145. package/src/config/Options/shape/polar.ts +3 -3
  146. package/src/config/Options/shape/radar.ts +2 -2
  147. package/src/config/Options/shape/scatter.ts +1 -1
  148. package/src/config/Options/shape/treemap.ts +1 -1
  149. package/src/config/Store/Element.ts +8 -5
  150. package/src/config/Store/State.ts +20 -13
  151. package/src/config/classes.ts +14 -4
  152. package/src/config/config.ts +1 -1
  153. package/src/config/const.ts +2 -0
  154. package/src/config/resolver/axis.ts +4 -4
  155. package/src/config/resolver/interaction.ts +3 -7
  156. package/src/config/resolver/shape.ts +17 -12
  157. package/src/core.ts +2 -3
  158. package/src/index.esm.ts +3 -6
  159. package/src/index.ts +2 -2
  160. package/src/module/Cache.ts +2 -3
  161. package/src/module/browser.ts +15 -10
  162. package/src/module/error.ts +9 -8
  163. package/src/module/generator.ts +3 -5
  164. package/src/module/util.ts +62 -39
  165. package/src/module/worker.ts +14 -11
  166. package/src/scss/billboard.scss +18 -0
  167. package/src/scss/theme/dark.scss +17 -0
  168. package/src/scss/theme/datalab.scss +17 -0
  169. package/src/scss/theme/graph.scss +17 -0
  170. package/src/scss/theme/insight.scss +17 -0
  171. package/src/scss/theme/modern.scss +17 -0
  172. package/types/axis.d.ts +17 -0
  173. package/types/bb.d.ts +1 -0
  174. package/types/index.d.ts +1 -0
  175. package/types/options.d.ts +9 -0
  176. package/types/options.shape.d.ts +26 -1
  177. package/types/types.d.ts +1 -0
@@ -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 && globalThis) ||
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" && typeof w?.cancelAnimationFrame === "function";
37
- const hasRIC = typeof w?.requestIdleCallback === "function" && typeof w?.cancelIdleCallback === "function";
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
+ };
@@ -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 && logError(`Please, make sure if %c${camelize(type)}`, "module has been imported and specified correctly.");
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 = "https://github.com/naver/billboard.js/wiki/CHANGELOG-v2#modularization-by-its-functionality";
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}`, "background:red;color:white;display:block;font-size:15px", tail);
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
 
@@ -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 {window, requestIdleCallback} from "./browser";
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;
@@ -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, window, requestAnimationFrame} from "./browser";
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
- isboolean,
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 ((...args: any[]) => any) => typeof v === "function";
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 isboolean = (v: unknown): boolean => typeof v === "boolean";
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, "&lt;").replace(/(script)?>/ig, "&gt;") : str;
174
+ str.replace(/<(script|img)?/ig, "&lt;").replace(/(script)?>/ig, "&gt;") :
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, y, width, height
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 && (event.touches || (event.sourceEvent && event.sourceEvent.touches))?.[0];
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
- // check from brush area selection
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(node): {
309
- left: number, top: number, right: number, bottom: number,
310
- x: number, y: number, width: number, height: number
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") && node.rect.width !== +node.getAttribute("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 => s
482
- .replace(/\s?(bb-)/g, ".$1")
483
- .replace(/\.+/g, ".");
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 | any {
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, cancelable: false, screenX: 0, screenY: 0, clientX: 0, clientY: 0
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, params.screenY,
690
- params.clientX, params.clientY,
691
- false, false, false, false, 0, null
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
- // Ref: https://github.com/Modernizr/Modernizr/blob/master/feature-detects/touchevents.js
792
- // On IE11 with IE9 emulation mode, ('ontouchstart' in window) is returning true
793
- } else if ("ontouchmove" in window || (DocumentTouch && document instanceof DocumentTouch)) {
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(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(UA) ||
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
-
@@ -62,22 +62,25 @@ function getWorker(src) {
62
62
  * @returns {object}
63
63
  * @example
64
64
  * const worker = runWorker(function(arg) {
65
- * // do some tasks...
66
- * console.log("param:", A(arg));
65
+ * // do some tasks...
66
+ * console.log("param:", A(arg));
67
67
  *
68
- * return 1234;
69
- * }, function(data) {
70
- * // callback after worker is done
71
- * console.log("result:", data);
72
- * },
73
- * [function A(){}]
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
- * worker(11111);
76
+ * worker(11111);
77
77
  * @private
78
78
  */
79
79
  export function runWorker(
80
- useWorker = true, fn: Function, callback: Function, depsFn?: Function[]
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);
@@ -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 --*/
@@ -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
@@ -19,6 +19,7 @@ export {
19
19
  bubble,
20
20
  candlestick,
21
21
  donut,
22
+ funnel,
22
23
  gauge,
23
24
  line,
24
25
  pie,
@@ -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 {