billboard.js 3.3.0-next.1 → 3.3.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 (96) hide show
  1. package/dist/billboard.css +1 -1
  2. package/dist/billboard.js +644 -427
  3. package/dist/billboard.min.css +1 -1
  4. package/dist/billboard.min.js +2 -2
  5. package/dist/billboard.pkgd.js +2809 -2331
  6. package/dist/billboard.pkgd.min.js +3 -3
  7. package/dist/plugin/billboardjs-plugin-bubblecompare.d.ts +7 -0
  8. package/dist/plugin/billboardjs-plugin-bubblecompare.js +2 -2
  9. package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
  10. package/dist/plugin/billboardjs-plugin-sparkline.d.ts +7 -0
  11. package/dist/plugin/billboardjs-plugin-sparkline.js +156 -103
  12. package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
  13. package/dist/plugin/billboardjs-plugin-stanford.d.ts +7 -0
  14. package/dist/plugin/billboardjs-plugin-stanford.js +154 -101
  15. package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
  16. package/dist/plugin/billboardjs-plugin-tableview.d.ts +7 -0
  17. package/dist/plugin/billboardjs-plugin-tableview.js +20 -128
  18. package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
  19. package/dist/plugin/billboardjs-plugin-textoverlap.d.ts +7 -0
  20. package/dist/plugin/billboardjs-plugin-textoverlap.js +20 -128
  21. package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
  22. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.js +2166 -1905
  23. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.js +2325 -2011
  24. package/dist/plugin/pkgd/billboardjs-plugin-stanford.js +2320 -2006
  25. package/dist/plugin/pkgd/billboardjs-plugin-tableview.js +2186 -2033
  26. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.js +2187 -2034
  27. package/dist/theme/datalab.css +1 -1
  28. package/dist/theme/datalab.min.css +2 -2
  29. package/dist/theme/graph.css +1 -1
  30. package/dist/theme/graph.min.css +2 -2
  31. package/dist/theme/insight.css +1 -1
  32. package/dist/theme/insight.min.css +2 -2
  33. package/dist-esm/billboard.js +642 -440
  34. package/dist-esm/plugin/billboardjs-plugin-bubblecompare.d.ts +7 -0
  35. package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -4
  36. package/dist-esm/plugin/billboardjs-plugin-sparkline.d.ts +7 -0
  37. package/dist-esm/plugin/billboardjs-plugin-sparkline.js +131 -79
  38. package/dist-esm/plugin/billboardjs-plugin-stanford.d.ts +7 -0
  39. package/dist-esm/plugin/billboardjs-plugin-stanford.js +135 -80
  40. package/dist-esm/plugin/billboardjs-plugin-tableview.d.ts +7 -0
  41. package/dist-esm/plugin/billboardjs-plugin-tableview.js +4 -8
  42. package/dist-esm/plugin/billboardjs-plugin-textoverlap.d.ts +7 -0
  43. package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +4 -7
  44. package/package.json +39 -38
  45. package/src/Chart/api/chart.ts +8 -2
  46. package/src/Chart/api/data.ts +3 -4
  47. package/src/Chart/api/focus.ts +8 -8
  48. package/src/Chart/api/regions.ts +3 -3
  49. package/src/Chart/api/selection.ts +15 -15
  50. package/src/Chart/api/subchart.ts +10 -10
  51. package/src/ChartInternal/Axis/Axis.ts +26 -19
  52. package/src/ChartInternal/ChartInternal.ts +8 -7
  53. package/src/ChartInternal/data/IData.ts +9 -0
  54. package/src/ChartInternal/data/data.ts +4 -4
  55. package/src/ChartInternal/data/load.ts +2 -2
  56. package/src/ChartInternal/interactions/drag.ts +15 -15
  57. package/src/ChartInternal/interactions/eventrect.ts +18 -18
  58. package/src/ChartInternal/interactions/interaction.ts +46 -14
  59. package/src/ChartInternal/interactions/zoom.ts +4 -4
  60. package/src/ChartInternal/internals/color.ts +4 -4
  61. package/src/ChartInternal/internals/domain.ts +1 -1
  62. package/src/ChartInternal/internals/format.ts +9 -4
  63. package/src/ChartInternal/internals/grid.ts +32 -32
  64. package/src/ChartInternal/internals/legend.ts +27 -27
  65. package/src/ChartInternal/internals/redraw.ts +6 -5
  66. package/src/ChartInternal/internals/region.ts +3 -3
  67. package/src/ChartInternal/internals/selection.ts +16 -15
  68. package/src/ChartInternal/internals/size.ts +3 -3
  69. package/src/ChartInternal/internals/text.ts +8 -8
  70. package/src/ChartInternal/internals/title.ts +4 -4
  71. package/src/ChartInternal/internals/tooltip.ts +5 -6
  72. package/src/ChartInternal/internals/transform.ts +5 -5
  73. package/src/ChartInternal/shape/arc.ts +24 -22
  74. package/src/ChartInternal/shape/area.ts +4 -4
  75. package/src/ChartInternal/shape/bar.ts +11 -9
  76. package/src/ChartInternal/shape/candlestick.ts +8 -8
  77. package/src/ChartInternal/shape/gauge.ts +8 -8
  78. package/src/ChartInternal/shape/line.ts +7 -7
  79. package/src/ChartInternal/shape/point.ts +18 -18
  80. package/src/ChartInternal/shape/radar.ts +12 -10
  81. package/src/ChartInternal/shape/shape.ts +43 -11
  82. package/src/Plugin/sparkline/index.ts +4 -4
  83. package/src/Plugin/stanford/index.ts +3 -3
  84. package/src/Plugin/stanford/util.ts +0 -1
  85. package/src/config/Options/axis/x.ts +25 -5
  86. package/src/config/Options/axis/y.ts +24 -3
  87. package/src/config/Options/axis/y2.ts +24 -3
  88. package/src/config/Options/common/tooltip.ts +10 -1
  89. package/src/config/Options/shape/bar.ts +8 -0
  90. package/src/config/classes.ts +154 -66
  91. package/src/module/util.ts +17 -11
  92. package/types/axis.d.ts +22 -8
  93. package/types/chart.d.ts +1 -1
  94. package/types/options.d.ts +32 -32
  95. package/types/plugin/tableview/index.d.ts +3 -3
  96. package/types/plugin/tableview/options.d.ts +1 -1
@@ -7,7 +7,6 @@ import {pointer as d3Pointer} from "d3-selection";
7
7
  import {brushSelection as d3BrushSelection} from "d3-brush";
8
8
  import {d3Selection} from "../../types/types";
9
9
  import {document, window} from "./browser";
10
- import CLASS from "../config/classes";
11
10
 
12
11
  export {
13
12
  asHalfPixel,
@@ -284,7 +283,7 @@ function getBrushSelection(ctx) {
284
283
  if (event && event.type === "brush") {
285
284
  selection = event.selection;
286
285
  // check from brush area selection
287
- } else if (main && (selection = main.select(`.${CLASS.brush}`).node())) {
286
+ } else if (main && (selection = main.select(".bb-brush").node())) {
288
287
  selection = d3BrushSelection(selection);
289
288
  }
290
289
 
@@ -731,21 +730,28 @@ function isTabVisible(): boolean {
731
730
  * @private
732
731
  */
733
732
  function convertInputType(mouse: boolean, touch: boolean): "mouse" | "touch" | null {
734
- let isMobile = false;
733
+ let hasTouch = false;
735
734
 
736
- // https://developer.mozilla.org/en-US/docs/Web/HTTP/Browser_detection_using_the_user_agent#Mobile_Tablet_or_Desktop
737
- if (/Mobi/.test(window.navigator.userAgent) && touch) {
735
+ if (touch) {
738
736
  // Some Edge desktop return true: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/20417074/
739
- const hasTouchPoints = window.navigator && "maxTouchPoints" in window.navigator && window.navigator.maxTouchPoints > 0;
737
+ if (window.navigator && "maxTouchPoints" in window.navigator) {
738
+ hasTouch = window.navigator.maxTouchPoints > 0;
740
739
 
741
740
  // Ref: https://github.com/Modernizr/Modernizr/blob/master/feature-detects/touchevents.js
742
741
  // On IE11 with IE9 emulation mode, ('ontouchstart' in window) is returning true
743
- const hasTouch = ("ontouchmove" in window || (window.DocumentTouch && document instanceof window.DocumentTouch));
744
-
745
- isMobile = hasTouchPoints || hasTouch;
742
+ } else if ("ontouchmove" in window || (window.DocumentTouch && document instanceof window.DocumentTouch)) {
743
+ hasTouch = true;
744
+ } else {
745
+ // https://developer.mozilla.org/en-US/docs/Web/HTTP/Browser_detection_using_the_user_agent#avoiding_user_agent_detection
746
+ const mQ = window.matchMedia && matchMedia("(pointer:coarse)");
747
+
748
+ if (mQ && mQ.media === "(pointer:coarse)") {
749
+ hasTouch = !!mQ.matches;
750
+ }
751
+ }
746
752
  }
747
753
 
748
- const hasMouse = mouse && !isMobile ? ("onmouseover" in window) : false;
754
+ const hasMouse = mouse && !hasTouch ? ("onmouseover" in window) : false;
749
755
 
750
- return (hasMouse && "mouse") || (isMobile && "touch") || null;
756
+ return (hasMouse && "mouse") || (hasTouch && "touch") || null;
751
757
  }
package/types/axis.d.ts CHANGED
@@ -94,10 +94,10 @@ export interface xAxisConfiguration extends AxisConfigurationBase {
94
94
  * Set default extent for subchart and zoom.
95
95
  * This can be an array or function that returns an array.
96
96
  */
97
- extent?: number[] | string[] | (
97
+ extent?: Array<number|string> | (
98
98
  (
99
99
  this: Chart,
100
- domain: Date|string|number[],
100
+ domain: Array<Date|string|number>,
101
101
  scale: (value: any) => number
102
102
  ) => number[]
103
103
  );
@@ -197,14 +197,21 @@ export interface XTickConfiguration {
197
197
 
198
198
  /**
199
199
  * Setting for culling ticks.
200
- * If true is set, the ticks will be culled, then only limitted tick text will be shown.
201
- * This option does not hide the tick lines. If false is set, all of ticks will be shown.
200
+ * - `true`: the ticks will be culled, then only limited tick text will be shown.
201
+ * This option does not hide the tick lines by default, if want to hide tick lines, set `axis.x.tick.culling.lines=false`.
202
+ * - `false`: all of ticks will be shown.
203
+ * The number of ticks to be shown can be chaned by `axis.x.tick.culling.max`.
202
204
  */
203
205
  culling?: boolean | {
204
206
  /**
205
207
  * The number of tick texts will be adjusted to less than this value.
206
208
  */
207
209
  max?: number;
210
+
211
+ /**
212
+ * Control visibility of tick lines within culling option, along with tick text.
213
+ */
214
+ lines?: boolean;
208
215
  };
209
216
 
210
217
  /**
@@ -226,7 +233,7 @@ export interface XTickConfiguration {
226
233
  * If this option is provided, the position of the ticks will be determined based on those values.
227
234
  * This option works with timeseries data and the x values will be parsed accoding to the type of the value and data.xFormat option.
228
235
  */
229
- values?: number[] | string[] | ((this: Chart) => number[]);
236
+ values?: Array<number|string> | ((this: Chart) => number[]);
230
237
 
231
238
  /**
232
239
  * Rotate x axis tick text.
@@ -334,14 +341,21 @@ export interface YTickConfiguration {
334
341
 
335
342
  /**
336
343
  * Setting for culling ticks.
337
- * If true is set, the ticks will be culled, then only limitted tick text will be shown.
338
- * This option does not hide the tick lines. If false is set, all of ticks will be shown.
344
+ * - `true`: the ticks will be culled, then only limited tick text will be shown.
345
+ * This option does not hide the tick lines by default, if want to hide tick lines, set `axis.[y|y2].tick.culling.lines=false`.
346
+ * - `false`: all of ticks will be shown.
347
+ * The number of ticks to be shown can be chaned by `axis.[y|y2].tick.culling.max`.
339
348
  */
340
349
  culling?: boolean | {
341
350
  /**
342
351
  * The number of tick texts will be adjusted to less than this value.
343
352
  */
344
353
  max?: number;
354
+
355
+ /**
356
+ * Control visibility of tick lines within culling option, along with tick text.
357
+ */
358
+ lines?: boolean;
345
359
  };
346
360
 
347
361
  /**
@@ -400,6 +414,6 @@ export interface AxesConfiguration {
400
414
  /**
401
415
  * Set tick values manually
402
416
  */
403
- values?: number|string|Date[];
417
+ values?: Array<number|string|Date>;
404
418
  };
405
419
  }
package/types/chart.d.ts CHANGED
@@ -347,7 +347,7 @@ export interface Chart {
347
347
  load(this: Chart, args: {
348
348
  append?: boolean;
349
349
  url?: string;
350
- json?: [{ [key: string]: string | number }] | {[key: string]: string[] | number[]};
350
+ json?: [{ [key: string]: string | number }] | {[key: string]: Array<string|number>};
351
351
  rows?: PrimitiveArray[];
352
352
  columns?: PrimitiveArray[];
353
353
  data?: Array<{ [key: string]: number }>;
@@ -275,31 +275,6 @@ export interface ChartOptions {
275
275
  };
276
276
 
277
277
  bar?: {
278
- /**
279
- * Change the width of bar chart. If ratio is specified, change the width of bar chart by ratio.
280
- */
281
- width?: number | {
282
- /**
283
- * Set the width of each bar by ratio
284
- */
285
- ratio: number;
286
-
287
- /**
288
- * Set max width of each bar
289
- */
290
- max?: number;
291
- } | {
292
- /**
293
- * Set the width option for specific dataset
294
- */
295
- [key: string]: number | {
296
- ratio: number;
297
- max: number;
298
- }
299
- };
300
-
301
- headers?: Array<{ [key: string]: string; }>;
302
-
303
278
  /**
304
279
  * Set threshold ratio to show/hide labels.
305
280
  */
@@ -308,14 +283,11 @@ export interface ChartOptions {
308
283
  }
309
284
 
310
285
  /**
311
- * Set if min or max value will be 0 on bar chart.
312
- */
313
- zerobased?: boolean;
314
-
315
- /**
316
- * Set space between bars in bar charts
286
+ * Remove nullish data on bar indices positions.
317
287
  */
318
- space?: number;
288
+ indices?: {
289
+ removeNull?: boolean;
290
+ }
319
291
 
320
292
  /**
321
293
  * The padding pixel value between each bar.
@@ -337,6 +309,34 @@ export interface ChartOptions {
337
309
  * The senstivity offset value for interaction boundary.
338
310
  */
339
311
  sensitivity?: number;
312
+
313
+ /**
314
+ * Change the width of bar chart. If ratio is specified, change the width of bar chart by ratio.
315
+ */
316
+ width?: number | {
317
+ /**
318
+ * Set the width of each bar by ratio
319
+ */
320
+ ratio: number;
321
+
322
+ /**
323
+ * Set max width of each bar
324
+ */
325
+ max?: number;
326
+ } | {
327
+ /**
328
+ * Set the width option for specific dataset
329
+ */
330
+ [key: string]: number | {
331
+ ratio: number;
332
+ max: number;
333
+ }
334
+ };
335
+
336
+ /**
337
+ * Set if min or max value will be 0 on bar chart.
338
+ */
339
+ zerobased?: boolean;
340
340
  };
341
341
 
342
342
  bubble?: {
@@ -3,11 +3,11 @@
3
3
  * billboard.js project is licensed under the MIT license
4
4
  */
5
5
  import {Plugin} from "../plugin";
6
- import {TabieViewOptions} from "./options";
6
+ import {TableViewOptions} from "./options";
7
7
 
8
- export default class TabieView extends Plugin {
8
+ export default class TableView extends Plugin {
9
9
  /**
10
10
  * Generate stanford diagram
11
11
  */
12
- constructor(options?: TabieViewOptions);
12
+ constructor(options?: TableViewOptions);
13
13
  }
@@ -1,4 +1,4 @@
1
- export interface TabieViewOptions {
1
+ export interface TableViewOptions {
2
2
  /**
3
3
  * Set tableview holder selector.
4
4
  * - **NOTE:** If not set, will append new holder element dynamically.