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
@@ -3,9 +3,17 @@
3
3
  * billboard.js project is licensed under the MIT license
4
4
  */
5
5
  import {line as d3Line} from "d3-shape";
6
- import {getScale} from "../internals/scale";
7
6
  import {$COMMON, $LINE} from "../../config/classes";
8
- import {getPointer, getRandom, isArray, isDefined, isUndefined, isValue, parseDate} from "../../module/util";
7
+ import {
8
+ getPointer,
9
+ getRandom,
10
+ isArray,
11
+ isDefined,
12
+ isUndefined,
13
+ isValue,
14
+ parseDate
15
+ } from "../../module/util";
16
+ import {getScale} from "../internals/scale";
9
17
 
10
18
  export default {
11
19
  initLine(): void {
@@ -94,7 +102,7 @@ export default {
94
102
  redrawLine(drawFn, withTransition?: boolean, isSub = false) {
95
103
  const $$ = this;
96
104
  const {$el, $T} = $$;
97
- const {line} = (isSub ? $el.subchart : $el);
105
+ const {line} = isSub ? $el.subchart : $el;
98
106
 
99
107
  return [
100
108
  $T(line, withTransition, getRandom())
@@ -116,31 +124,33 @@ export default {
116
124
 
117
125
  // when is step & rotated, should be computed in different way
118
126
  // https://github.com/naver/billboard.js/issues/471
119
- return isRotatedStepType ? context => {
120
- const step = $$.getInterpolate(d)(context);
127
+ return isRotatedStepType ?
128
+ context => {
129
+ const step = $$.getInterpolate(d)(context);
121
130
 
122
- // keep the original method
123
- step.orgPoint = step.point;
131
+ // keep the original method
132
+ step.orgPoint = step.point;
124
133
 
125
- // to get rotated path data
126
- step.pointRotated = function(x, y) {
127
- this._point === 1 && (this._point = 2);
134
+ // to get rotated path data
135
+ step.pointRotated = function(x, y) {
136
+ this._point === 1 && (this._point = 2);
128
137
 
129
- const y1 = this._y * (1 - this._t) + y * this._t;
138
+ const y1 = this._y * (1 - this._t) + y * this._t;
130
139
 
131
- this._context.lineTo(this._x, y1);
132
- this._context.lineTo(x, y1);
140
+ this._context.lineTo(this._x, y1);
141
+ this._context.lineTo(x, y1);
133
142
 
134
- this._x = x;
135
- this._y = y;
136
- };
143
+ this._x = x;
144
+ this._y = y;
145
+ };
137
146
 
138
- step.point = function(x, y) {
139
- this._point === 0 ? this.orgPoint(x, y) : this.pointRotated(x, y);
140
- };
147
+ step.point = function(x, y) {
148
+ this._point === 0 ? this.orgPoint(x, y) : this.pointRotated(x, y);
149
+ };
141
150
 
142
- return step;
143
- } : $$.getInterpolate(d);
151
+ return step;
152
+ } :
153
+ $$.getInterpolate(d);
144
154
  },
145
155
 
146
156
  generateDrawLine(lineIndices, isSub?: boolean): (d) => string {
@@ -154,15 +164,12 @@ export default {
154
164
 
155
165
  const xValue = d => (isSub ? $$.subxx : $$.xx).call($$, d);
156
166
  const yValue = (d, i) => (
157
- $$.isGrouped(d.id) ?
158
- getPoints(d, i)[0][1] :
159
- yScale(d.id, isSub)($$.getBaseValue(d))
167
+ $$.isGrouped(d.id) ? getPoints(d, i)[0][1] : yScale(d.id, isSub)($$.getBaseValue(d))
160
168
  );
161
169
 
162
170
  let line = d3Line();
163
171
 
164
- line = isRotated ?
165
- line.x(yValue).y(xValue) : line.x(xValue).y(yValue);
172
+ line = isRotated ? line.x(yValue).y(xValue) : line.x(xValue).y(yValue);
166
173
 
167
174
  if (!lineConnectNull) {
168
175
  line = line.defined(d => $$.getBaseValue(d) !== null);
@@ -236,25 +243,34 @@ export default {
236
243
  const yValue = isRotated ? dt => x(dt.x) : dt => y(dt.value);
237
244
 
238
245
  // Define svg generator function for region
239
- const generateM = points => `M${points[0][0]},${points[0][1]}L${points[1][0]},${points[1][1]}`;
240
- const sWithRegion = isTimeSeries ? (d0, d1, k, timeseriesDiff) => {
241
- const x0 = d0.x.getTime();
242
- const xDiff = d1.x - d0.x;
243
- const xv0 = new Date(x0 + xDiff * k);
244
- const xv1 = new Date(x0 + xDiff * (k + timeseriesDiff));
245
-
246
- const points = isRotated ?
247
- [[y(yp(k)), x(xv0)], [y(yp(k + diff)), x(xv1)]] :
248
- [[x(xv0), y(yp(k))], [x(xv1), y(yp(k + diff))]];
249
-
250
- return generateM(points);
251
- } : (d0, d1, k, otherDiff) => {
252
- const points = isRotated ?
253
- [[y(yp(k), true), x(xp(k))], [y(yp(k + otherDiff), true), x(xp(k + otherDiff))]] :
254
- [[x(xp(k), true), y(yp(k))], [x(xp(k + otherDiff), true), y(yp(k + otherDiff))]];
255
-
256
- return generateM(points);
257
- };
246
+ const generateM = points =>
247
+ `M${points[0][0]},${points[0][1]}L${points[1][0]},${points[1][1]}`;
248
+ const sWithRegion = isTimeSeries ?
249
+ (d0, d1, k, timeseriesDiff) => {
250
+ const x0 = d0.x.getTime();
251
+ const xDiff = d1.x - d0.x;
252
+ const xv0 = new Date(x0 + xDiff * k);
253
+ const xv1 = new Date(x0 + xDiff * (k + timeseriesDiff));
254
+
255
+ const points = isRotated ?
256
+ [[y(yp(k)), x(xv0)], [y(yp(k + diff)), x(xv1)]] :
257
+ [[x(xv0), y(yp(k))], [x(xv1), y(yp(k + diff))]];
258
+
259
+ return generateM(points);
260
+ } :
261
+ (d0, d1, k, otherDiff) => {
262
+ const points = isRotated ?
263
+ [[y(yp(k), true), x(xp(k))], [
264
+ y(yp(k + otherDiff), true),
265
+ x(xp(k + otherDiff))
266
+ ]] :
267
+ [[x(xp(k), true), y(yp(k))], [
268
+ x(xp(k + otherDiff), true),
269
+ y(yp(k + otherDiff))
270
+ ]];
271
+
272
+ return generateM(points);
273
+ };
258
274
 
259
275
  // Generate
260
276
  const axisType = {x: $$.axis.getAxisType("x"), y: $$.axis.getAxisType("y")};
@@ -324,5 +340,5 @@ export default {
324
340
 
325
341
  return linePoint === true ||
326
342
  (isArray(linePoint) && linePoint.indexOf(d.id) !== -1);
327
- },
343
+ }
328
344
  };
@@ -2,10 +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 {
6
- namespaces as d3Namespaces,
7
- select as d3Select
8
- } from "d3-selection";
5
+ import {namespaces as d3Namespaces, select as d3Select} from "d3-selection";
9
6
  import {document} from "../../module/browser";
10
7
  import {isFunction, isObjectType, notEmpty, toArray} from "../../module/util";
11
8
 
@@ -3,9 +3,17 @@
3
3
  * billboard.js project is licensed under the MIT license
4
4
  */
5
5
  import {select as d3Select} from "d3-selection";
6
- import {$CIRCLE, $COMMON, $SELECT} from "../../config/classes";
7
- import {getBoundingRect, getPointer, getRandom, isFunction, isObject, isUndefined, isValue} from "../../module/util";
8
6
  import type {d3Selection} from "../../../types/types";
7
+ import {$CIRCLE, $COMMON, $SELECT} from "../../config/classes";
8
+ import {
9
+ getBoundingRect,
10
+ getPointer,
11
+ getRandom,
12
+ isFunction,
13
+ isObject,
14
+ isUndefined,
15
+ isValue
16
+ } from "../../module/util";
9
17
  import type {IDataPoint, IDataRow} from "../data/IData";
10
18
 
11
19
  const getTransitionName = () => getRandom();
@@ -17,7 +25,9 @@ export default {
17
25
 
18
26
  if (isUndefined(opacity)) {
19
27
  opacity = this.getBaseValue(d) !== null &&
20
- withoutFadeIn[d.id] ? this.opacityForCircle(d) : "0";
28
+ withoutFadeIn[d.id] ?
29
+ this.opacityForCircle(d) :
30
+ "0";
21
31
  }
22
32
 
23
33
  return opacity;
@@ -31,8 +41,8 @@ export default {
31
41
  opacity = config.point_show && !this.isPointFocusOnly?.() ? null : "0";
32
42
 
33
43
  opacity = isValue(this.getBaseValue(d)) ?
34
- (this.isBubbleType(d) || this.isScatterType(d) ?
35
- "0.5" : opacity) : "0";
44
+ (this.isBubbleType(d) || this.isScatterType(d) ? "0.5" : opacity) :
45
+ "0";
36
46
  }
37
47
 
38
48
  return opacity;
@@ -42,9 +52,12 @@ export default {
42
52
  const $$ = this;
43
53
  const {$el: {main}} = $$;
44
54
 
45
- $$.point = $$.generatePoint();
55
+ !$$.point && ($$.point = $$.generatePoint());
46
56
 
47
- if (($$.hasType("bubble") || $$.hasType("scatter")) && main.select(`.${$CIRCLE.chartCircles}`).empty()) {
57
+ if (
58
+ ($$.hasType("bubble") || $$.hasType("scatter")) &&
59
+ main.select(`.${$COMMON.chart} > .${$CIRCLE.chartCircles}`).empty()
60
+ ) {
48
61
  main.select(`.${$COMMON.chart}`)
49
62
  .append("g")
50
63
  .attr("class", $CIRCLE.chartCircles);
@@ -62,14 +75,14 @@ export default {
62
75
  return;
63
76
  }
64
77
 
65
- !$el.circle && $$.initCircle();
78
+ $$.initCircle();
66
79
 
67
80
  let targets = targetsValue;
68
81
  let enterNode = enterNodeValue;
69
82
 
70
83
  // only for scatter & bubble type should generate seprate <g> node
71
84
  if (!targets) {
72
- targets = (data.targets)
85
+ targets = data.targets
73
86
  .filter(d => this.isScatterType(d) || this.isBubbleType(d));
74
87
 
75
88
  const mainCircle = $el.main.select(`.${$CIRCLE.chartCircles}`)
@@ -88,7 +101,9 @@ export default {
88
101
  enterNode.append("g")
89
102
  .attr("class", classCircles)
90
103
  .call(selection => {
91
- $$.setCssRule(true, `.${$CIRCLE.circles}`, ["cursor:pointer"], isSelectable)(selection);
104
+ $$.setCssRule(true, `.${$CIRCLE.circles}`, ["cursor:pointer"], isSelectable)(
105
+ selection
106
+ );
92
107
  $$.setCssRule(true, ` .${$CIRCLE.circle}`, ["fill", "stroke"], $$.color)(selection);
93
108
  })
94
109
  .style("opacity", function() {
@@ -122,14 +137,17 @@ export default {
122
137
  .data(d => (
123
138
  ($$.isLineType(d) && $$.shouldDrawPointsForLine(d)) ||
124
139
  $$.isBubbleType(d) || $$.isRadarType(d) || $$.isScatterType(d) ?
125
- (focusOnly ? [d.values[0]] : d.values) : [])
126
- );
140
+ (focusOnly ? [d.values[0]] : d.values) :
141
+ []
142
+ ));
127
143
 
128
144
  circles.exit().remove();
129
145
 
130
146
  circles.enter()
131
147
  .filter(Boolean)
132
- .append($$.point("create", this, $$.pointR.bind($$), $$.updateCircleColor.bind($$)));
148
+ .append(
149
+ $$.point("create", this, $$.pointR.bind($$), $$.updateCircleColor.bind($$))
150
+ );
133
151
 
134
152
  $root.circle = $root.main.selectAll(`.${$CIRCLE.circles} .${$CIRCLE.circle}`)
135
153
  .style("stroke", $$.getStylePropValue($$.color))
@@ -147,8 +165,7 @@ export default {
147
165
  const $$ = this;
148
166
  const fn = $$.getStylePropValue($$.color);
149
167
 
150
- return $$.config.point_radialGradient ?
151
- $$.getGradienColortUrl(d.id) : (fn ? fn(d) : null);
168
+ return $$.config.point_radialGradient ? $$.getGradienColortUrl(d.id) : (fn ? fn(d) : null);
152
169
  },
153
170
 
154
171
  redrawCircle(cx: Function, cy: Function, withTransition: boolean, flow, isSub = false) {
@@ -161,7 +178,8 @@ export default {
161
178
  return [];
162
179
  }
163
180
 
164
- const fn = $$.point("update", $$, cx, cy, $$.updateCircleColor.bind($$), withTransition, flow, selectedCircles);
181
+ const fn = $$.point("update", $$, cx, cy, $$.updateCircleColor.bind($$), withTransition,
182
+ flow, selectedCircles);
165
183
  const posAttr = $$.isCirclePoint() ? "c" : "";
166
184
 
167
185
  const t = getRandom();
@@ -199,15 +217,15 @@ export default {
199
217
  const cx = (hasRadar ? $$.radarCircleX : $$.circleX).bind($$);
200
218
  const cy = (hasRadar ? $$.radarCircleY : $$.circleY).bind($$);
201
219
  const withTransition = toggling || isUndefined(d);
202
- const fn = $$.point("update", $$, cx, cy, $$.getStylePropValue($$.color), resizing ? false : withTransition);
220
+ const fn = $$.point("update", $$, cx, cy, $$.getStylePropValue($$.color),
221
+ resizing ? false : withTransition);
203
222
 
204
223
  if (d) {
205
224
  circle = circle
206
225
  .filter(function(t) {
207
226
  const data = d.filter?.(v => v.id === t.id);
208
227
 
209
- return data.length ?
210
- d3Select(this).datum(data[0]) : false;
228
+ return data.length ? d3Select(this).datum(data[0]) : false;
211
229
  });
212
230
  }
213
231
 
@@ -332,15 +350,15 @@ export default {
332
350
  const scale = $$.isBubbleType(d) ? 1.15 : 1.75;
333
351
 
334
352
  return config.point_focus_expand_enabled ?
335
- (config.point_focus_expand_r || $$.pointR(d) * scale) : $$.pointR(d);
353
+ (config.point_focus_expand_r || $$.pointR(d) * scale) :
354
+ $$.pointR(d);
336
355
  },
337
356
 
338
357
  pointSelectR(d): number {
339
358
  const $$ = this;
340
359
  const selectR = $$.config.point_select_r;
341
360
 
342
- return isFunction(selectR) ?
343
- selectR(d) : (selectR || $$.pointR(d) * 4);
361
+ return isFunction(selectR) ? selectR(d) : (selectR || $$.pointR(d) * 4);
344
362
  },
345
363
 
346
364
  /**
@@ -360,7 +378,9 @@ export default {
360
378
  const mouse = getPointer(state.event, node);
361
379
  const element = d3Select(node);
362
380
  const prefix = this.isCirclePoint(node) ? "c" : "";
363
- const sensitivity = config.point_sensitivity === "radius" ? node.getAttribute("r") : config.point_sensitivity;
381
+ const sensitivity = config.point_sensitivity === "radius" ?
382
+ node.getAttribute("r") :
383
+ config.point_sensitivity;
364
384
  let cx = +element.attr(`${prefix}x`);
365
385
  let cy = +element.attr(`${prefix}y`);
366
386
 
@@ -410,13 +430,14 @@ export default {
410
430
  }
411
431
 
412
432
  this.setAttribute("class", className);
413
- }) : $$.getClass("circle", true)(d);
433
+ }) :
434
+ $$.getClass("circle", true)(d);
414
435
  }
415
436
 
416
437
  return pointClass;
417
438
  },
418
439
 
419
- generateGetLinePoints(lineIndices, isSub?: boolean):Function { // partial duplication of generateGetBarPoints
440
+ generateGetLinePoints(lineIndices, isSub?: boolean): Function { // partial duplication of generateGetBarPoints
420
441
  const $$ = this;
421
442
  const {config} = $$;
422
443
  const x = $$.getShapeX(0, lineIndices, isSub);
@@ -431,9 +452,11 @@ export default {
431
452
  let posY = y(d);
432
453
 
433
454
  // fix posY not to overflow opposite quadrant
434
- if (config.axis_rotated && (
435
- (d.value > 0 && posY < y0) || (d.value < 0 && y0 < posY)
436
- )) {
455
+ if (
456
+ config.axis_rotated && (
457
+ (d.value > 0 && posY < y0) || (d.value < 0 && y0 < posY)
458
+ )
459
+ ) {
437
460
  posY = y0;
438
461
  }
439
462
 
@@ -458,8 +481,7 @@ export default {
458
481
  .node();
459
482
  },
460
483
 
461
- update(element, xPosFn, yPosFn, fillStyleFn,
462
- withTransition, flow, selectedCircles) {
484
+ update(element, xPosFn, yPosFn, fillStyleFn, withTransition, flow, selectedCircles) {
463
485
  const $$ = this;
464
486
  const {width, height} = element.node().getBBox();
465
487
 
@@ -491,8 +513,7 @@ export default {
491
513
  .node();
492
514
  },
493
515
 
494
- update(element, xPosFn, yPosFn, fillStyleFn,
495
- withTransition, flow, selectedCircles) {
516
+ update(element, xPosFn, yPosFn, fillStyleFn, withTransition, flow, selectedCircles) {
496
517
  const $$ = this;
497
518
  let mainCircles = element;
498
519
 
@@ -531,8 +552,7 @@ export default {
531
552
  .node();
532
553
  },
533
554
 
534
- update(element, xPosFn, yPosFn, fillStyleFn,
535
- withTransition, flow, selectedCircles) {
555
+ update(element, xPosFn, yPosFn, fillStyleFn, withTransition, flow, selectedCircles) {
536
556
  const $$ = this;
537
557
  const r = $$.config.point_r;
538
558
  const rectXPosFn = d => xPosFn(d) - r;
@@ -41,7 +41,7 @@ export default {
41
41
 
42
42
  // set level text background color
43
43
  if (levelTextShow && levelTextBgColor) {
44
- $$.generateDataLabelBackgroundColorFilter(levelTextBgColor);
44
+ $$.generateTextBGColorFilter(levelTextBgColor);
45
45
  }
46
46
  },
47
47
 
@@ -116,7 +116,9 @@ export default {
116
116
 
117
117
  if (config.polar_level_text_show) {
118
118
  const levelTextBackgroundColor = config.polar_level_text_backgroundColor;
119
- const defsId = `#${state.datetimeId}-labels-bg${$$.getTargetSelectorSuffix(levelTextBackgroundColor)}`;
119
+ const defsId = `#${state.datetimeId}-labels-bg${
120
+ $$.getTargetSelectorSuffix(levelTextBackgroundColor)
121
+ }`;
120
122
 
121
123
  levelEnter.append("text")
122
124
  .style("text-anchor", "middle");
@@ -3,9 +3,19 @@
3
3
  * billboard.js project is licensed under the MIT license
4
4
  */
5
5
  import {select as d3Select} from "d3-selection";
6
- import {KEY} from "../../module/Cache";
7
6
  import {$AXIS, $COMMON, $LEVEL, $RADAR, $SHAPE, $TEXT} from "../../config/classes";
8
- import {getMinMax, getPathBox, getRange, isDefined, isEmpty, isNumber, isUndefined, setTextValue, toArray} from "../../module/util";
7
+ import {KEY} from "../../module/Cache";
8
+ import {
9
+ getMinMax,
10
+ getPathBox,
11
+ getRange,
12
+ isDefined,
13
+ isEmpty,
14
+ isNumber,
15
+ isUndefined,
16
+ setTextValue,
17
+ toArray
18
+ } from "../../module/util";
9
19
 
10
20
  /**
11
21
  * Get the position value
@@ -18,7 +28,8 @@ import {getMinMax, getPathBox, getRange, isDefined, isEmpty, isNumber, isUndefin
18
28
  * @returns {number}
19
29
  * @private
20
30
  */
21
- function getPosition(isClockwise: boolean, type: "x" | "y", edge: number, pos: number, range: number, ratio: number): number {
31
+ function getPosition(isClockwise: boolean, type: "x" | "y", edge: number, pos: number,
32
+ range: number, ratio: number): number {
22
33
  const index = isClockwise && pos > 0 ? edge - pos : pos;
23
34
  const r = 2 * Math.PI;
24
35
  const func = type === "x" ? Math.sin : Math.cos;
@@ -67,7 +78,7 @@ export default {
67
78
  const $$ = this;
68
79
  const {config, state: {arcWidth, arcHeight}} = $$;
69
80
  const padding = config.axis_x_categories.length < 4 ? -20 : 10;
70
- const size = ((Math.min(arcWidth, arcHeight) - padding) / 2);
81
+ const size = (Math.min(arcWidth, arcHeight) - padding) / 2;
71
82
 
72
83
  return [size, size];
73
84
  },
@@ -77,7 +88,9 @@ export default {
77
88
  const {config} = $$;
78
89
 
79
90
  if (isEmpty(config.axis_x_categories)) {
80
- config.axis_x_categories = getRange(0, getMinMax("max", targets.map(v => v.values.length)));
91
+ config.axis_x_categories = getRange(0, getMinMax("max", targets.map(v =>
92
+ v.values.length
93
+ )));
81
94
  }
82
95
 
83
96
  $$.generateRadarPoints();
@@ -90,14 +103,16 @@ export default {
90
103
  const edge = config.axis_x_categories.length;
91
104
  const isClockwise = config.radar_direction_clockwise;
92
105
 
93
- const pos = toArray(type).map(v => getPosition(
94
- isClockwise,
95
- v,
96
- edge,
97
- index,
98
- isDefined(range) ? range : (type === "x" ? width : height),
99
- isNumber(ratio) ? ratio : config.radar_size_ratio
100
- ));
106
+ const pos = toArray(type).map(v =>
107
+ getPosition(
108
+ isClockwise,
109
+ v,
110
+ edge,
111
+ index,
112
+ isDefined(range) ? range : (type === "x" ? width : height),
113
+ isNumber(ratio) ? ratio : config.radar_size_ratio
114
+ )
115
+ );
101
116
 
102
117
  return pos.length === 1 ? pos[0] : pos;
103
118
  },
@@ -177,8 +192,10 @@ export default {
177
192
  // Generate points
178
193
  const points = levelData.map(v => {
179
194
  const range = levelRatio[v];
180
- const pos = getRange(0, edge).map(i => (
181
- $$.getRadarPosition(["x", "y"], i, range, 1)).join(",")
195
+ const pos = getRange(0, edge).map(i =>
196
+ (
197
+ $$.getRadarPosition(["x", "y"], i, range, 1)
198
+ ).join(",")
182
199
  );
183
200
 
184
201
  return pos.join(" ");
@@ -209,14 +226,17 @@ export default {
209
226
  levelEnter.append("text")
210
227
  .attr("dx", "-.5em")
211
228
  .style("text-anchor", "end")
212
- .text(d => levelTextFormat(
213
- state.current.dataMax / levelData.length * (d + 1)
214
- ));
229
+ .text(d =>
230
+ levelTextFormat(
231
+ state.current.dataMax / levelData.length * (d + 1)
232
+ )
233
+ );
215
234
  }
216
235
 
217
236
  levelEnter
218
237
  .merge(level)
219
- .attr("transform", d => `translate(${width - levelRatio[d]}, ${height - levelRatio[d]})`)
238
+ .attr("transform",
239
+ d => `translate(${width - levelRatio[d]}, ${height - levelRatio[d]})`)
220
240
  .selectAll("polygon")
221
241
  .attr("points", d => points[d]);
222
242
 
@@ -327,9 +347,7 @@ export default {
327
347
  if (isMouse || noIndex) {
328
348
  $$.hideTooltip();
329
349
 
330
- focusOnly ?
331
- $$.hideCircleFocus() :
332
- $$.unexpandCircles();
350
+ focusOnly ? $$.hideCircleFocus() : $$.unexpandCircles();
333
351
 
334
352
  if (isMouse) {
335
353
  $$.setOverOut(false, index);