billboard.js 3.3.0 → 3.3.1

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 (72) hide show
  1. package/dist/billboard.css +1 -1
  2. package/dist/billboard.js +424 -374
  3. package/dist/billboard.min.css +1 -1
  4. package/dist/billboard.min.js +2 -2
  5. package/dist/billboard.pkgd.js +2284 -2200
  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 +137 -92
  10. package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
  11. package/dist/plugin/billboardjs-plugin-stanford.js +138 -93
  12. package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
  13. package/dist/plugin/billboardjs-plugin-tableview.js +3 -119
  14. package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
  15. package/dist/plugin/billboardjs-plugin-textoverlap.js +3 -119
  16. package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
  17. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.js +1862 -1828
  18. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.js +1998 -1919
  19. package/dist/plugin/pkgd/billboardjs-plugin-stanford.js +2000 -1921
  20. package/dist/plugin/pkgd/billboardjs-plugin-tableview.js +1866 -1948
  21. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.js +1866 -1948
  22. package/dist/theme/datalab.css +1 -1
  23. package/dist/theme/datalab.min.css +2 -2
  24. package/dist/theme/graph.css +1 -1
  25. package/dist/theme/graph.min.css +2 -2
  26. package/dist/theme/insight.css +1 -1
  27. package/dist/theme/insight.min.css +2 -2
  28. package/dist-esm/billboard.js +426 -383
  29. package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -4
  30. package/dist-esm/plugin/billboardjs-plugin-sparkline.js +129 -77
  31. package/dist-esm/plugin/billboardjs-plugin-stanford.js +135 -80
  32. package/dist-esm/plugin/billboardjs-plugin-tableview.js +4 -8
  33. package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +4 -7
  34. package/package.json +15 -15
  35. package/src/Chart/api/focus.ts +8 -8
  36. package/src/Chart/api/regions.ts +3 -3
  37. package/src/Chart/api/selection.ts +15 -15
  38. package/src/Chart/api/subchart.ts +3 -3
  39. package/src/ChartInternal/Axis/Axis.ts +13 -12
  40. package/src/ChartInternal/ChartInternal.ts +5 -6
  41. package/src/ChartInternal/data/data.ts +3 -3
  42. package/src/ChartInternal/data/load.ts +2 -2
  43. package/src/ChartInternal/interactions/drag.ts +15 -15
  44. package/src/ChartInternal/interactions/eventrect.ts +18 -18
  45. package/src/ChartInternal/interactions/interaction.ts +10 -10
  46. package/src/ChartInternal/interactions/zoom.ts +4 -4
  47. package/src/ChartInternal/internals/color.ts +4 -4
  48. package/src/ChartInternal/internals/domain.ts +1 -1
  49. package/src/ChartInternal/internals/grid.ts +32 -32
  50. package/src/ChartInternal/internals/legend.ts +27 -27
  51. package/src/ChartInternal/internals/redraw.ts +3 -3
  52. package/src/ChartInternal/internals/region.ts +3 -3
  53. package/src/ChartInternal/internals/selection.ts +16 -15
  54. package/src/ChartInternal/internals/size.ts +3 -3
  55. package/src/ChartInternal/internals/text.ts +8 -8
  56. package/src/ChartInternal/internals/title.ts +4 -4
  57. package/src/ChartInternal/internals/tooltip.ts +5 -5
  58. package/src/ChartInternal/internals/transform.ts +5 -5
  59. package/src/ChartInternal/shape/arc.ts +22 -22
  60. package/src/ChartInternal/shape/area.ts +4 -4
  61. package/src/ChartInternal/shape/bar.ts +7 -7
  62. package/src/ChartInternal/shape/candlestick.ts +8 -8
  63. package/src/ChartInternal/shape/gauge.ts +8 -8
  64. package/src/ChartInternal/shape/line.ts +7 -7
  65. package/src/ChartInternal/shape/point.ts +18 -18
  66. package/src/ChartInternal/shape/radar.ts +10 -10
  67. package/src/ChartInternal/shape/shape.ts +4 -2
  68. package/src/Plugin/sparkline/index.ts +2 -2
  69. package/src/Plugin/stanford/index.ts +3 -3
  70. package/src/Plugin/stanford/util.ts +0 -1
  71. package/src/config/classes.ts +154 -66
  72. package/src/module/util.ts +1 -2
@@ -3,7 +3,7 @@
3
3
  * billboard.js project is licensed under the MIT license
4
4
  */
5
5
  import {select as d3Select} from "d3-selection"; // selection
6
- import CLASS from "../../config/classes";
6
+ import {$REGION} from "../../config/classes";
7
7
  import {isValue, parseDate} from "../../module/util";
8
8
  import {AxisType} from "../../../types/types";
9
9
 
@@ -15,7 +15,7 @@ export default {
15
15
  $el.region.main = $el.main
16
16
  .insert("g", ":first-child")
17
17
  .attr("clip-path", $$.state.clip.path)
18
- .attr("class", CLASS.regions);
18
+ .attr("class", $REGION.regions);
19
19
  },
20
20
 
21
21
  updateRegion(): void {
@@ -31,7 +31,7 @@ export default {
31
31
  // select <g> element
32
32
 
33
33
  let list = region.main
34
- .selectAll(`.${CLASS.region}`)
34
+ .selectAll(`.${$REGION.region}`)
35
35
  .data(config.regions);
36
36
 
37
37
  $T(list.exit())
@@ -4,7 +4,7 @@
4
4
  */
5
5
  import {select as d3Select} from "d3-selection";
6
6
  import drag from "../interactions/drag";
7
- import CLASS from "../../config/classes";
7
+ import {$SELECT, $SHAPE} from "../../config/classes";
8
8
  import {callFn} from "../../module/util";
9
9
 
10
10
  export default {
@@ -28,12 +28,12 @@ export default {
28
28
  callFn(config.data_onselected, $$.api, d, target.node());
29
29
 
30
30
  // add selected-circle on low layer g
31
- $T(main.select(`.${CLASS.selectedCircles}${$$.getTargetSelectorSuffix(d.id)}`)
32
- .selectAll(`.${CLASS.selectedCircle}-${i}`)
31
+ $T(main.select(`.${$SELECT.selectedCircles}${$$.getTargetSelectorSuffix(d.id)}`)
32
+ .selectAll(`.${$SELECT.selectedCircle}-${i}`)
33
33
  .data([d])
34
34
  .enter()
35
35
  .append("circle")
36
- .attr("class", () => $$.generateClass(CLASS.selectedCircle, i))
36
+ .attr("class", () => $$.generateClass($SELECT.selectedCircle, i))
37
37
  .attr("cx", cx)
38
38
  .attr("cy", cy)
39
39
  .attr("stroke", $$.color)
@@ -55,8 +55,8 @@ export default {
55
55
  callFn(config.data_onunselected, $$.api, d, target.node());
56
56
 
57
57
  // remove selected-circle from low layer g
58
- $T(main.select(`.${CLASS.selectedCircles}${$$.getTargetSelectorSuffix(d.id)}`)
59
- .selectAll(`.${CLASS.selectedCircle}-${i}`)
58
+ $T(main.select(`.${$SELECT.selectedCircles}${$$.getTargetSelectorSuffix(d.id)}`)
59
+ .selectAll(`.${$SELECT.selectedCircle}-${i}`)
60
60
  )
61
61
  .attr("r", 0)
62
62
  .remove();
@@ -152,33 +152,34 @@ export default {
152
152
  toggleShape(that, d, i: number): void {
153
153
  const $$ = this;
154
154
  const {config, $el: {main}} = $$;
155
- const shape = d3Select(that);
156
- const isSelected = shape.classed(CLASS.SELECTED);
157
- const toggle = $$.getToggle(that, d).bind($$);
158
- let toggledShape;
159
155
 
160
156
  if (config.data_selection_enabled && config.data_selection_isselectable.bind($$.api)(d)) {
157
+ const shape = d3Select(that);
158
+ const isSelected = shape.classed($SELECT.SELECTED);
159
+ const toggle = $$.getToggle(that, d).bind($$);
160
+ let toggledShape;
161
+
161
162
  if (!config.data_selection_multiple) {
162
- let selector = `.${CLASS.shapes}`;
163
+ let selector = `.${$SHAPE.shapes}`;
163
164
 
164
165
  if (config.data_selection_grouped) {
165
166
  selector += $$.getTargetSelectorSuffix(d.id);
166
167
  }
167
168
 
168
169
  main.selectAll(selector)
169
- .selectAll(`.${CLASS.shape}`)
170
+ .selectAll(`.${$SHAPE.shape}`)
170
171
  .each(function(d, i) {
171
172
  const shape = d3Select(this);
172
173
 
173
- if (shape.classed(CLASS.SELECTED)) {
174
+ if (shape.classed($SELECT.SELECTED)) {
174
175
  toggledShape = shape;
175
- toggle(false, shape.classed(CLASS.SELECTED, false), d, i);
176
+ toggle(false, shape.classed($SELECT.SELECTED, false), d, i);
176
177
  }
177
178
  });
178
179
  }
179
180
 
180
181
  if (!toggledShape || toggledShape.node() !== shape.node()) {
181
- shape.classed(CLASS.SELECTED, !isSelected);
182
+ shape.classed($SELECT.SELECTED, !isSelected);
182
183
  toggle(!isSelected, shape, d, i);
183
184
  }
184
185
  }
@@ -3,7 +3,7 @@
3
3
  * billboard.js project is licensed under the MIT license
4
4
  */
5
5
  import {document} from "../../module/browser";
6
- import CLASS from "../../config/classes";
6
+ import {$AXIS, $SUBCHART} from "../../config/classes";
7
7
  import {isValue, ceil10, capitalize, isNumber, isEmpty} from "../../module/util";
8
8
 
9
9
  export default {
@@ -170,7 +170,7 @@ export default {
170
170
  const $$ = this;
171
171
  const {config, $el} = $$;
172
172
  const hasLeftAxisRect = config.axis_rotated || (!config.axis_rotated && !config.axis_y_inner);
173
- const leftAxisClass = config.axis_rotated ? CLASS.axisX : CLASS.axisY;
173
+ const leftAxisClass = config.axis_rotated ? $AXIS.axisX : $AXIS.axisY;
174
174
  const leftAxis = $el.main.select(`.${leftAxisClass}`).node();
175
175
  const svgRect = leftAxis && hasLeftAxisRect ? leftAxis.getBoundingClientRect() : {right: 0};
176
176
  const chartRect = $el.chart.node().getBoundingClientRect();
@@ -204,7 +204,7 @@ export default {
204
204
  .attr("height", current.height);
205
205
 
206
206
  if (hasAxis) {
207
- const brush = svg.select(`.${CLASS.brush} .overlay`);
207
+ const brush = svg.select(`.${$SUBCHART.brush} .overlay`);
208
208
  const brushSize = {width: 0, height: 0};
209
209
 
210
210
  if (brush.size()) {
@@ -7,7 +7,7 @@ import {
7
7
  selectAll as d3SelectAll
8
8
  } from "d3-selection";
9
9
  import {KEY} from "../../module/Cache";
10
- import CLASS from "../../config/classes";
10
+ import {$COMMON, $TEXT} from "../../config/classes";
11
11
  import {capitalize, getBoundingRect, getRandom, isFunction, isNumber, isObject, isString, getTranslation, setTextValue} from "../../module/util";
12
12
  import {IDataRow, IArcData} from "../data/IData";
13
13
  import {AxisType} from "../../../types/types";
@@ -28,8 +28,8 @@ export default {
28
28
  initText(): void {
29
29
  const {$el} = this;
30
30
 
31
- $el.main.select(`.${CLASS.chart}`).append("g")
32
- .attr("class", CLASS.chartTexts);
31
+ $el.main.select(`.${$COMMON.chart}`).append("g")
32
+ .attr("class", $TEXT.chartTexts);
33
33
  },
34
34
 
35
35
  /**
@@ -43,7 +43,7 @@ export default {
43
43
  const classTexts = $$.getClass("texts", "id");
44
44
 
45
45
  const classFocus = $$.classFocus.bind($$);
46
- const mainTextUpdate = $$.$el.main.select(`.${CLASS.chartTexts}`).selectAll(`.${CLASS.chartText}`)
46
+ const mainTextUpdate = $$.$el.main.select(`.${$TEXT.chartTexts}`).selectAll(`.${$TEXT.chartText}`)
47
47
  .data(targets)
48
48
  .attr("class", d => classChartText(d) + classFocus(d));
49
49
 
@@ -65,8 +65,8 @@ export default {
65
65
  const {$el, $T, config} = $$;
66
66
  const classText = $$.getClass("text", "index");
67
67
 
68
- const text = $el.main.selectAll(`.${CLASS.texts}`)
69
- .selectAll(`.${CLASS.text}`)
68
+ const text = $el.main.selectAll(`.${$TEXT.texts}`)
69
+ .selectAll(`.${$TEXT.text}`)
70
70
  .data($$.labelishData.bind($$));
71
71
 
72
72
  $T(text.exit())
@@ -475,7 +475,7 @@ export default {
475
475
  const overlapsY = Math.ceil(Math.abs(translate.f - coordinate.f)) <
476
476
  parseInt(textNode.style("font-size"), 10);
477
477
 
478
- filteredTextNode.classed(CLASS.TextOverlapping, overlapsX && overlapsY);
478
+ filteredTextNode.classed($TEXT.TextOverlapping, overlapsX && overlapsY);
479
479
  });
480
480
  },
481
481
 
@@ -490,7 +490,7 @@ export default {
490
490
  $$.$el.arcs.selectAll(selector)
491
491
  .each(function() {
492
492
  d3SelectAll([this, this.previousSibling])
493
- .classed(CLASS.TextOverlapping, false);
493
+ .classed($TEXT.TextOverlapping, false);
494
494
  });
495
495
  },
496
496
 
@@ -3,7 +3,7 @@
3
3
  * billboard.js project is licensed under the MIT license
4
4
  */
5
5
  import {isNumber, setTextValue} from "../../module/util";
6
- import CLASS from "../../config/classes";
6
+ import {$TEXT} from "../../config/classes";
7
7
 
8
8
  /**
9
9
  * Get the text position
@@ -42,7 +42,7 @@ export default {
42
42
  const text = $el.title
43
43
  .append("text")
44
44
  .style("text-anchor", getTextPos(config.title_position))
45
- .attr("class", CLASS.title);
45
+ .attr("class", $TEXT.title);
46
46
 
47
47
  setTextValue(text, config.title_text, [0.3, 1.5]);
48
48
  }
@@ -76,7 +76,7 @@ export default {
76
76
  const $$ = this;
77
77
  const {config, state: {current}} = $$;
78
78
  const position = config.title_position || "left";
79
- const textRectWidth = $$.getTextRect($$.$el.title, CLASS.title).width;
79
+ const textRectWidth = $$.getTextRect($$.$el.title, $TEXT.title).width;
80
80
  let x;
81
81
 
82
82
  if (/(right|center)/.test(position)) {
@@ -103,7 +103,7 @@ export default {
103
103
  const $$ = this;
104
104
 
105
105
  return ($$.config.title_padding.top || 0) +
106
- $$.getTextRect($$.$el.title, CLASS.title).height;
106
+ $$.getTextRect($$.$el.title, $TEXT.title).height;
107
107
  },
108
108
 
109
109
  /**
@@ -4,7 +4,7 @@
4
4
  */
5
5
  import {select as d3Select} from "d3-selection";
6
6
  import {document} from "../../module/browser";
7
- import CLASS from "../../config/classes";
7
+ import {$ARC, $TOOLTIP} from "../../config/classes";
8
8
  import {IDataRow} from "../data/IData";
9
9
  import {getPointer, isFunction, isObject, isString, isValue, callFn, sanitise, tplProcess, isUndefined, parseDate} from "../../module/util";
10
10
 
@@ -22,7 +22,7 @@ export default {
22
22
  if ($el.tooltip.empty()) {
23
23
  $el.tooltip = $el.chart
24
24
  .append("div")
25
- .attr("class", CLASS.tooltipContainer)
25
+ .attr("class", $TOOLTIP.tooltipContainer)
26
26
  .style("position", "absolute")
27
27
  .style("pointer-events", "none")
28
28
  .style("display", "none");
@@ -176,7 +176,7 @@ export default {
176
176
  sanitise(titleFormat ? titleFormat(row.x) : row.x);
177
177
 
178
178
  text = tplProcess(tpl[0], {
179
- CLASS_TOOLTIP: CLASS.tooltip,
179
+ CLASS_TOOLTIP: $TOOLTIP.tooltip,
180
180
  TITLE: isValue(title) ? (
181
181
  tplStr ? title : `<tr><th colspan="2">${title}</th></tr>`
182
182
  ) : ""
@@ -184,7 +184,7 @@ export default {
184
184
  }
185
185
 
186
186
  if (!row.ratio && $$.$el.arcs) {
187
- row.ratio = $$.getRatio("arc", $$.$el.arcs.select(`path.${CLASS.arc}-${row.id}`).data()[0]);
187
+ row.ratio = $$.getRatio("arc", $$.$el.arcs.select(`path.${$ARC.arc}-${row.id}`).data()[0]);
188
188
  }
189
189
 
190
190
  param = [row.ratio, row.id, row.index, d];
@@ -217,7 +217,7 @@ export default {
217
217
  const name = sanitise(nameFormat(row.name, ...param));
218
218
  const color = getBgColor(row);
219
219
  const contentValue = {
220
- CLASS_TOOLTIP_NAME: CLASS.tooltipName + $$.getTargetSelectorSuffix(row.id),
220
+ CLASS_TOOLTIP_NAME: $TOOLTIP.tooltipName + $$.getTargetSelectorSuffix(row.id),
221
221
  COLOR: (tplStr || !$$.patterns) ? color : `<svg><rect style="fill:${color}" width="10" height="10"></rect></svg>`,
222
222
  NAME: name,
223
223
  VALUE: value
@@ -2,7 +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 CLASS from "../../config/classes";
5
+ import {$ARC, $AXIS} from "../../config/classes";
6
6
  import {asHalfPixel} from "../../module/util";
7
7
 
8
8
  type TranslateParam = "main" | "context" | "legend" | "x" | "y" | "y2" | "subX" | "arc" | "radar";
@@ -60,16 +60,16 @@ export default {
60
60
 
61
61
  const xAxis = transitions?.axisX ?
62
62
  transitions.axisX :
63
- $T(main.select(`.${CLASS.axisX}`), withTransition);
63
+ $T(main.select(`.${$AXIS.axisX}`), withTransition);
64
64
 
65
65
  const yAxis = transitions?.axisY ?
66
66
  transitions.axisY :
67
- $T(main.select(`.${CLASS.axisY}`), withTransition);
67
+ $T(main.select(`.${$AXIS.axisY}`), withTransition);
68
68
 
69
69
 
70
70
  const y2Axis = transitions?.axisY2 ?
71
71
  transitions.axisY2 :
72
- $T(main.select(`.${CLASS.axisY2}`), withTransition);
72
+ $T(main.select(`.${$AXIS.axisY2}`), withTransition);
73
73
 
74
74
  $T(main, withTransition)
75
75
  .attr("transform", $$.getTranslate("main"));
@@ -78,7 +78,7 @@ export default {
78
78
  yAxis.attr("transform", $$.getTranslate("y"));
79
79
  y2Axis.attr("transform", $$.getTranslate("y2"));
80
80
 
81
- main.select(`.${CLASS.chartArcs}`)
81
+ main.select(`.${$ARC.chartArcs}`)
82
82
  .attr("transform", $$.getTranslate("arc"));
83
83
  },
84
84
 
@@ -9,7 +9,7 @@ import {
9
9
  } from "d3-shape";
10
10
  import {interpolate as d3Interpolate} from "d3-interpolate";
11
11
  import {document} from "../../module/browser";
12
- import CLASS from "../../config/classes";
12
+ import {$ARC, $COMMON, $FOCUS, $GAUGE} from "../../config/classes";
13
13
  import {callFn, endall, isFunction, isNumber, isObject, isUndefined, setTextValue} from "../../module/util";
14
14
  import {d3Selection} from "../../../types/types";
15
15
  import {IData} from "../data/IData";
@@ -364,7 +364,7 @@ export default {
364
364
  if (!transiting) {
365
365
  clearInterval(interval);
366
366
 
367
- $el.legend.selectAll(`.${CLASS.legendItemFocused}`).size() > 0 &&
367
+ $el.legend.selectAll(`.${$FOCUS.legendItemFocused}`).size() > 0 &&
368
368
  $$.expandArc(targetIds);
369
369
  }
370
370
  }, 10);
@@ -374,7 +374,7 @@ export default {
374
374
 
375
375
  const newTargetIds = $$.mapToTargetIds(targetIds);
376
376
 
377
- $el.svg.selectAll($$.selectorTargets(newTargetIds, `.${CLASS.chartArc}`))
377
+ $el.svg.selectAll($$.selectorTargets(newTargetIds, `.${$ARC.chartArc}`))
378
378
  .each(function(d) {
379
379
  if (!$$.shouldExpand(d.data.id)) {
380
380
  return;
@@ -403,13 +403,13 @@ export default {
403
403
 
404
404
  const newTargetIds = $$.mapToTargetIds(targetIds);
405
405
 
406
- svg.selectAll($$.selectorTargets(newTargetIds, `.${CLASS.chartArc}`))
406
+ svg.selectAll($$.selectorTargets(newTargetIds, `.${$ARC.chartArc}`))
407
407
  .selectAll("path")
408
408
  .transition()
409
409
  .duration(d => $$.getExpandConfig(d.data.id, "duration"))
410
410
  .attr("d", $$.svgArc);
411
411
 
412
- svg.selectAll(`${CLASS.arc}`)
412
+ svg.selectAll(`${$ARC.arc}`)
413
413
  .style("opacity", null);
414
414
  },
415
415
 
@@ -485,10 +485,10 @@ export default {
485
485
  const classChartArc = $$.getChartClass("Arc");
486
486
  const classArcs = $$.getClass("arcs", true);
487
487
  const classFocus = $$.classFocus.bind($$);
488
- const chartArcs = $el.main.select(`.${CLASS.chartArcs}`);
488
+ const chartArcs = $el.main.select(`.${$ARC.chartArcs}`);
489
489
 
490
490
  const mainPieUpdate = chartArcs
491
- .selectAll(`.${CLASS.chartArc}`)
491
+ .selectAll(`.${$ARC.chartArc}`)
492
492
  .data($$.pie(targets))
493
493
  .attr("class", d => classChartArc(d) + classFocus(d.data));
494
494
 
@@ -505,7 +505,7 @@ export default {
505
505
  .style("text-anchor", "middle")
506
506
  .style("pointer-events", "none");
507
507
 
508
- $el.text = chartArcs.selectAll(`.${CLASS.target} text`);
508
+ $el.text = chartArcs.selectAll(`.${$COMMON.target} text`);
509
509
  // MEMO: can not keep same color..., but not bad to update color in redraw
510
510
  // mainPieUpdate.exit().remove();
511
511
  },
@@ -514,9 +514,9 @@ export default {
514
514
  const $$ = this;
515
515
  const {$el} = $$;
516
516
 
517
- $el.arcs = $el.main.select(`.${CLASS.chart}`)
517
+ $el.arcs = $el.main.select(`.${$COMMON.chart}`)
518
518
  .append("g")
519
- .attr("class", CLASS.chartArcs)
519
+ .attr("class", $ARC.chartArcs)
520
520
  .attr("transform", $$.getTranslate("arc"));
521
521
 
522
522
  $$.setArcTitle();
@@ -533,7 +533,7 @@ export default {
533
533
 
534
534
  if (title) {
535
535
  const text = $$.$el.arcs.append("text")
536
- .attr("class", CLASS[hasGauge ? "chartArcsGaugeTitle" : "chartArcsTitle"])
536
+ .attr("class", hasGauge ? $GAUGE.chartArcsGaugeTitle : $ARC.chartArcsTitle)
537
537
  .style("text-anchor", "middle");
538
538
 
539
539
  hasGauge && text.attr("dy", "-0.3em");
@@ -548,8 +548,8 @@ export default {
548
548
  const hasInteraction = config.interaction_enabled;
549
549
  const isSelectable = hasInteraction && config.data_selection_isselectable;
550
550
 
551
- let mainArc = main.selectAll(`.${CLASS.arcs}`)
552
- .selectAll(`.${CLASS.arc}`)
551
+ let mainArc = main.selectAll(`.${$ARC.arcs}`)
552
+ .selectAll(`.${$ARC.arc}`)
553
553
  .data($$.arcData.bind($$));
554
554
 
555
555
  mainArc.exit()
@@ -661,19 +661,19 @@ export default {
661
661
  const endAngle = isFullCircle ? startAngle + $$.getArcLength() : startAngle * -1;
662
662
 
663
663
  let backgroundArc = $$.$el.arcs.select(
664
- `${hasMultiArcGauge ? "g" : ""}.${CLASS.chartArcsBackground}`
664
+ `${hasMultiArcGauge ? "g" : ""}.${$ARC.chartArcsBackground}`
665
665
  );
666
666
 
667
667
  if (hasMultiArcGauge) {
668
668
  let index = 0;
669
669
 
670
670
  backgroundArc = backgroundArc
671
- .selectAll(`path.${CLASS.chartArcsBackground}`)
671
+ .selectAll(`path.${$ARC.chartArcsBackground}`)
672
672
  .data($$.data.targets);
673
673
 
674
674
  backgroundArc.enter()
675
675
  .append("path")
676
- .attr("class", (d, i) => `${CLASS.chartArcsBackground} ${CLASS.chartArcsBackground}-${i}`)
676
+ .attr("class", (d, i) => `${$ARC.chartArcsBackground} ${$ARC.chartArcsBackground}-${i}`)
677
677
  .merge(backgroundArc)
678
678
  .style("fill", (config.gauge_background) || null)
679
679
  .attr("d", ({id}) => {
@@ -820,10 +820,10 @@ export default {
820
820
 
821
821
  // for gauge type, update text when has no title & multi data
822
822
  if (!(hasGauge && $$.data.targets.length === 1 && config.gauge_title)) {
823
- text = main.selectAll(`.${CLASS.chartArc}`)
823
+ text = main.selectAll(`.${$ARC.chartArc}`)
824
824
  .select("text")
825
825
  .style("opacity", "0")
826
- .attr("class", d => ($$.isGaugeType(d.data) ? CLASS.gaugeValue : null))
826
+ .attr("class", d => ($$.isGaugeType(d.data) ? $GAUGE.gaugeValue : null))
827
827
  .call($$.textForArcLabel.bind($$))
828
828
  .attr("transform", $$.transformForArcLabel.bind($$))
829
829
  .style("font-size", d => (
@@ -837,7 +837,7 @@ export default {
837
837
  hasMultiArcGauge && text.attr("dy", "-.1em");
838
838
  }
839
839
 
840
- main.select(`.${CLASS.chartArcsTitle}`)
840
+ main.select(`.${$ARC.chartArcsTitle}`)
841
841
  .style("opacity", $$.hasType("donut") || hasGauge ? null : "0");
842
842
 
843
843
  if (hasGauge) {
@@ -846,17 +846,17 @@ export default {
846
846
  isFullCircle && text?.attr("dy", `${hasMultiArcGauge ? 0 : Math.round(state.radius / 14)}`);
847
847
 
848
848
  if (config.gauge_label_show) {
849
- arcs.select(`.${CLASS.chartArcsGaugeUnit}`)
849
+ arcs.select(`.${$GAUGE.chartArcsGaugeUnit}`)
850
850
  .attr("dy", `${isFullCircle ? 1.5 : 0.75}em`)
851
851
  .text(config.gauge_units);
852
852
 
853
- arcs.select(`.${CLASS.chartArcsGaugeMin}`)
853
+ arcs.select(`.${$GAUGE.chartArcsGaugeMin}`)
854
854
  .attr("dx", `${-1 * (state.innerRadius + ((state.radius - state.innerRadius) / (isFullCircle ? 1 : 2)))}px`)
855
855
  .attr("dy", "1.2em")
856
856
  .text($$.textForGaugeMinMax(config.gauge_min, false));
857
857
 
858
858
  // show max text when isn't fullCircle
859
- !isFullCircle && arcs.select(`.${CLASS.chartArcsGaugeMax}`)
859
+ !isFullCircle && arcs.select(`.${$GAUGE.chartArcsGaugeMax}`)
860
860
  .attr("dx", `${state.innerRadius + ((state.radius - state.innerRadius) / 2)}px`)
861
861
  .attr("dy", "1.2em")
862
862
  .text($$.textForGaugeMinMax(config.gauge_max, true));
@@ -4,7 +4,7 @@
4
4
  */
5
5
  import {area as d3Area} from "d3-shape";
6
6
  import {select as d3Select} from "d3-selection";
7
- import CLASS from "../../config/classes";
7
+ import {$AREA, $CIRCLE, $LINE} from "../../config/classes";
8
8
  import {getRandom, isFunction} from "../../module/util";
9
9
 
10
10
  export default {
@@ -13,7 +13,7 @@ export default {
13
13
  const {config} = $$;
14
14
 
15
15
  mainLine
16
- .insert("g", `.${CLASS[config.area_front ? "circles" : "lines"]}`)
16
+ .insert("g", `.${config.area_front ? $CIRCLE.circles : $LINE.lines}`)
17
17
  .attr("class", $$.getClass("areas", true));
18
18
  },
19
19
 
@@ -72,8 +72,8 @@ export default {
72
72
 
73
73
  config.area_linearGradient && $$.updateAreaGradient();
74
74
 
75
- const area = $root.main.selectAll(`.${CLASS.areas}`)
76
- .selectAll(`.${CLASS.area}`)
75
+ const area = $root.main.selectAll(`.${$AREA.areas}`)
76
+ .selectAll(`.${$AREA.area}`)
77
77
  .data($$.lineData.bind($$));
78
78
 
79
79
  $T(area.exit(), withTransition)
@@ -3,7 +3,7 @@
3
3
  * billboard.js project is licensed under the MIT license
4
4
  */
5
5
  import {DataRow} from "../../../types/types";
6
- import CLASS from "../../config/classes";
6
+ import {$BAR, $COMMON} from "../../config/classes";
7
7
  import {getRandom, isNumber} from "../../module/util";
8
8
  import {IDataRow} from "../data/IData";
9
9
 
@@ -13,10 +13,10 @@ export default {
13
13
  initBar(): void {
14
14
  const {$el, config, state: {clip}} = this;
15
15
 
16
- $el.bar = $el.main.select(`.${CLASS.chart}`)
16
+ $el.bar = $el.main.select(`.${$COMMON.chart}`)
17
17
  // should positioned at the beginning of the shape node to not overlap others
18
18
  .insert("g", ":first-child")
19
- .attr("class", CLASS.chartBars);
19
+ .attr("class", $BAR.chartBars);
20
20
 
21
21
  // set clip-path attribute when condition meet
22
22
  // https://github.com/naver/billboard.js/issues/2421
@@ -39,8 +39,8 @@ export default {
39
39
  $$.initBar();
40
40
  }
41
41
 
42
- const mainBarUpdate = $$.$el.main.select(`.${CLASS.chartBars}`)
43
- .selectAll(`.${CLASS.chartBar}`)
42
+ const mainBarUpdate = $$.$el.main.select(`.${$BAR.chartBars}`)
43
+ .selectAll(`.${$BAR.chartBar}`)
44
44
  .data(
45
45
  // remove
46
46
  targets.filter(
@@ -73,8 +73,8 @@ export default {
73
73
  const classBar = $$.getClass("bar", true);
74
74
  const initialOpacity = $$.initialOpacity.bind($$);
75
75
 
76
- const bar = $root.main.selectAll(`.${CLASS.bars}`)
77
- .selectAll(`.${CLASS.bar}`)
76
+ const bar = $root.main.selectAll(`.${$BAR.bars}`)
77
+ .selectAll(`.${$BAR.bar}`)
78
78
  .data($$.labelishData.bind($$));
79
79
 
80
80
  $T(bar.exit(), withTransition)
@@ -3,7 +3,7 @@
3
3
  * billboard.js project is licensed under the MIT license
4
4
  */
5
5
  import {select as d3Select} from "d3-selection";
6
- import CLASS from "../../config/classes";
6
+ import {$CANDLESTICK, $COMMON} from "../../config/classes";
7
7
  import {getRandom, isArray, isNumber, isObject} from "../../module/util";
8
8
 
9
9
  type CandlestickData = {
@@ -18,10 +18,10 @@ export default {
18
18
  initCandlestick(): void {
19
19
  const {$el} = this;
20
20
 
21
- $el.candlestick = $el.main.select(`.${CLASS.chart}`)
21
+ $el.candlestick = $el.main.select(`.${$COMMON.chart}`)
22
22
  // should positioned at the beginning of the shape node to not overlap others
23
23
  .append("g")
24
- .attr("class", CLASS.chartCandlesticks);
24
+ .attr("class", $CANDLESTICK.chartCandlesticks);
25
25
  },
26
26
 
27
27
  /**
@@ -40,8 +40,8 @@ export default {
40
40
  $$.initCandlestick();
41
41
  }
42
42
 
43
- const mainUpdate = $$.$el.main.select(`.${CLASS.chartCandlesticks}`)
44
- .selectAll(`.${CLASS.chartCandlestick}`)
43
+ const mainUpdate = $$.$el.main.select(`.${$CANDLESTICK.chartCandlesticks}`)
44
+ .selectAll(`.${$CANDLESTICK.chartCandlestick}`)
45
45
  .data(targets)
46
46
  .attr("class", d => classChart(d) + classFocus(d));
47
47
 
@@ -63,8 +63,8 @@ export default {
63
63
  const classSetter = $$.getClass("candlestick", true);
64
64
  const initialOpacity = $$.initialOpacity.bind($$);
65
65
 
66
- const candlestick = $root.main.selectAll(`.${CLASS.chartCandlestick}`)
67
- .selectAll(`.${CLASS.candlestick}`)
66
+ const candlestick = $root.main.selectAll(`.${$CANDLESTICK.chartCandlestick}`)
67
+ .selectAll(`.${$CANDLESTICK.candlestick}`)
68
68
  .data($$.labelishData.bind($$));
69
69
 
70
70
  $T(candlestick.exit(), withTransition)
@@ -111,7 +111,7 @@ export default {
111
111
  const indexY = +!indexX;
112
112
 
113
113
  if (g.classed) {
114
- g.classed(CLASS[isUp ? "valueUp" : "valueDown"], true);
114
+ g.classed($CANDLESTICK[isUp ? "valueUp" : "valueDown"], true);
115
115
  }
116
116
 
117
117
  const path = isRotated ?
@@ -3,7 +3,7 @@
3
3
  * billboard.js project is licensed under the MIT license
4
4
  */
5
5
  import {select as d3Select} from "d3-selection";
6
- import CLASS from "../../config/classes";
6
+ import {$ARC, $COMMON, $GAUGE} from "../../config/classes";
7
7
  import {isFunction} from "../../module/util";
8
8
 
9
9
  export default {
@@ -21,14 +21,14 @@ export default {
21
21
  const hasMulti = $$.hasMultiArcGauge();
22
22
 
23
23
  arcs.append(hasMulti ? "g" : "path")
24
- .attr("class", CLASS.chartArcsBackground)
24
+ .attr("class", $ARC.chartArcsBackground)
25
25
  .style("fill", (!hasMulti && config.gauge_background) || null);
26
26
 
27
- config.gauge_units && appendText(CLASS.chartArcsGaugeUnit);
27
+ config.gauge_units && appendText($GAUGE.chartArcsGaugeUnit);
28
28
 
29
29
  if (config.gauge_label_show) {
30
- appendText(CLASS.chartArcsGaugeMin);
31
- !config.gauge_fullCircle && appendText(CLASS.chartArcsGaugeMax);
30
+ appendText($GAUGE.chartArcsGaugeMin);
31
+ !config.gauge_fullCircle && appendText($GAUGE.chartArcsGaugeMax);
32
32
  }
33
33
  }
34
34
  },
@@ -53,13 +53,13 @@ export default {
53
53
  const {config, state, $el} = $$;
54
54
  const {hiddenTargetIds} = $$.state;
55
55
 
56
- const arcLabelLines = $el.main.selectAll(`.${CLASS.arcs}`)
57
- .selectAll(`.${CLASS.arcLabelLine}`)
56
+ const arcLabelLines = $el.main.selectAll(`.${$ARC.arcs}`)
57
+ .selectAll(`.${$ARC.arcLabelLine}`)
58
58
  .data($$.arcData.bind($$));
59
59
 
60
60
  const mainArcLabelLine = arcLabelLines.enter()
61
61
  .append("rect")
62
- .attr("class", d => `${CLASS.arcLabelLine} ${CLASS.target} ${CLASS.target}-${d.data.id}`)
62
+ .attr("class", d => `${$ARC.arcLabelLine} ${$COMMON.target} ${$COMMON.target}-${d.data.id}`)
63
63
  .merge(arcLabelLines);
64
64
 
65
65
  mainArcLabelLine