billboard.js 3.4.0-next.1 → 3.4.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 (42) hide show
  1. package/dist/billboard.css +1 -1
  2. package/dist/billboard.js +121 -41
  3. package/dist/billboard.min.css +1 -1
  4. package/dist/billboard.min.js +2 -2
  5. package/dist/billboard.pkgd.js +121 -41
  6. package/dist/billboard.pkgd.min.js +2 -2
  7. package/dist/plugin/billboardjs-plugin-bubblecompare.js +2 -2
  8. package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
  9. package/dist/plugin/billboardjs-plugin-sparkline.js +2 -2
  10. package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
  11. package/dist/plugin/billboardjs-plugin-stanford.js +2 -2
  12. package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
  13. package/dist/plugin/billboardjs-plugin-tableview.js +2 -2
  14. package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
  15. package/dist/plugin/billboardjs-plugin-textoverlap.js +2 -2
  16. package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
  17. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.js +2 -2
  18. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.js +2 -2
  19. package/dist/plugin/pkgd/billboardjs-plugin-stanford.js +2 -2
  20. package/dist/plugin/pkgd/billboardjs-plugin-tableview.js +2 -2
  21. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.js +2 -2
  22. package/dist/theme/datalab.css +1 -1
  23. package/dist/theme/datalab.min.css +1 -1
  24. package/dist/theme/graph.css +1 -1
  25. package/dist/theme/graph.min.css +1 -1
  26. package/dist/theme/insight.css +1 -1
  27. package/dist/theme/insight.min.css +1 -1
  28. package/dist-esm/billboard.js +105 -36
  29. package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
  30. package/dist-esm/plugin/billboardjs-plugin-sparkline.js +2 -2
  31. package/dist-esm/plugin/billboardjs-plugin-stanford.js +2 -2
  32. package/dist-esm/plugin/billboardjs-plugin-tableview.js +2 -2
  33. package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +2 -2
  34. package/package.json +6 -6
  35. package/src/Chart/api/axis.ts +90 -25
  36. package/src/ChartInternal/ChartInternal.ts +6 -3
  37. package/src/ChartInternal/interactions/flow.ts +1 -1
  38. package/src/config/Options/common/main.ts +19 -2
  39. package/src/module/generator.ts +12 -4
  40. package/types/chart.d.ts +8 -8
  41. package/types/options.d.ts +7 -2
  42. package/types/types.d.ts +2 -0
@@ -151,6 +151,21 @@ export default {
151
151
  */
152
152
  resize_auto: true,
153
153
 
154
+ /**
155
+ * Set a callback to execute when the chart is clicked.
156
+ * @name onclick
157
+ * @memberof Options
158
+ * @type {Function}
159
+ * @default undefined
160
+ * @example
161
+ * onclick: function(event) {
162
+ * this; // chart instance itself
163
+ * event; // native event object
164
+ * ...
165
+ * }
166
+ */
167
+ onclick: <(() => void)|undefined> undefined,
168
+
154
169
  /**
155
170
  * Set a callback to execute when mouse/touch enters the chart.
156
171
  * @name onover
@@ -158,8 +173,9 @@ export default {
158
173
  * @type {Function}
159
174
  * @default undefined
160
175
  * @example
161
- * onover: function() {
176
+ * onover: function(event) {
162
177
  * this; // chart instance itself
178
+ * event; // native event object
163
179
  * ...
164
180
  * }
165
181
  */
@@ -172,8 +188,9 @@ export default {
172
188
  * @type {Function}
173
189
  * @default undefined
174
190
  * @example
175
- * onout: function() {
191
+ * onout: function(event) {
176
192
  * this; // chart instance itself
193
+ * event; // native event object
177
194
  * ...
178
195
  * }
179
196
  */
@@ -2,6 +2,7 @@
2
2
  * Copyright (c) 2017 ~ present NAVER Corp.
3
3
  * billboard.js project is licensed under the MIT license
4
4
  */
5
+ import {d3Transition} from "../../types/types";
5
6
  import {window} from "./browser";
6
7
  import {isArray} from "./util";
7
8
 
@@ -38,17 +39,24 @@ export function generateResize() {
38
39
  return callResizeFn;
39
40
  }
40
41
 
42
+ type Transition = boolean | d3Transition;
43
+
41
44
  /**
42
45
  * Generate transition queue function
43
46
  * @returns {Function}
44
47
  * @private
45
48
  */
46
49
  export function generateWait() {
47
- let transitionsToWait: any = [];
48
- const f = function(t, callback) {
50
+ let transitionsToWait: Transition[] = [];
51
+
52
+ // 'f' is called as selection.call(f, ...);
53
+ const f = function(selection: d3Transition, callback: Function) {
49
54
  let timer;
50
55
 
51
- // eslint-disable-next-line
56
+ /**
57
+ * Check if transition is complete
58
+ * @private
59
+ */
52
60
  function loop() {
53
61
  let done = 0;
54
62
 
@@ -77,7 +85,7 @@ export function generateWait() {
77
85
  loop();
78
86
  };
79
87
 
80
- f.add = function(t) {
88
+ f.add = function(t: Transition | Transition[]) {
81
89
  isArray(t) ?
82
90
  (transitionsToWait = transitionsToWait.concat(t)) :
83
91
  transitionsToWait.push(t);
package/types/chart.d.ts CHANGED
@@ -177,16 +177,16 @@ export interface Chart {
177
177
  * Get and set axis min value.
178
178
  * @param min If min is given, specified axis' min value will be updated. If no argument is given, the current min values for each axis will be returned.
179
179
  */
180
- min(min?: number | { [key: string]: number }): number | {
181
- [key: string]: number | { fit?: boolean; value?: number; }
180
+ min(min?: number | false | { [key: string]: number }): number | {
181
+ [key: string]: number | undefined
182
182
  };
183
183
 
184
184
  /**
185
185
  * Get and set axis max value.
186
186
  * @param max If max is given, specified axis' max value will be updated. If no argument is given, the current max values for each axis will be returned.
187
187
  */
188
- max(max?: number | { [key: string]: number }): number | {
189
- [key: string]: number | { fit?: boolean; value?: number; }
188
+ max(max?: number | false | { [key: string]: number }): number | {
189
+ [key: string]: number | undefined
190
190
  };
191
191
 
192
192
  /**
@@ -194,11 +194,11 @@ export interface Chart {
194
194
  * @param range If range is given, specified axis' min and max value will be updated. If no argument is given, the current min and max values for each axis will be returned.
195
195
  */
196
196
  range(range?: {
197
- min?: number | { [key: string]: number };
198
- max?: number | { [key: string]: number };
197
+ min?: number | false | { [key: string]: number | false };
198
+ max?: number | false | { [key: string]: number | false };
199
199
  }): {
200
- min: number | { [key: string]: number };
201
- max: number | { [key: string]: number };
200
+ min: number | { [key: string]: number | undefined };
201
+ max: number | { [key: string]: number | undefined };
202
202
  };
203
203
  };
204
204
 
@@ -804,15 +804,20 @@ export interface ChartOptions {
804
804
  */
805
805
  onrendered?(this: Chart): void;
806
806
 
807
+ /**
808
+ * Set a callback to execute when the chart is clicked.
809
+ */
810
+ onclick?(this: Chart, event: Event): void;
811
+
807
812
  /**
808
813
  * Set a callback to execute when mouse/touch enters the chart.
809
814
  */
810
- onover?(this: Chart): void;
815
+ onover?(this: Chart, event: Event): void;
811
816
 
812
817
  /**
813
818
  * Set a callback to execute when mouse/touch leaves the chart.
814
819
  */
815
- onout?(this: Chart): void;
820
+ onout?(this: Chart, event: Event): void;
816
821
 
817
822
  /**
818
823
  * Set a callback to execute when user resizes the screen.
package/types/types.d.ts CHANGED
@@ -3,6 +3,7 @@
3
3
  * billboard.js project is licensed under the MIT license
4
4
  */
5
5
  import {Selection} from "d3-selection";
6
+ import {Transition} from "d3-transition";
6
7
 
7
8
  export type PrimitiveArray = Array<
8
9
  string | boolean | number | Date | null |
@@ -10,6 +11,7 @@ export type PrimitiveArray = Array<
10
11
  >;
11
12
  export type ArrayOrString = string[] | string;
12
13
  export type d3Selection = Selection<any, any, any, any>;
14
+ export type d3Transition = Transition<any, any, any, any>;
13
15
  export type ChartTypes = "area"
14
16
  | "area-line-range"
15
17
  | "area-spline"