billboard.js 3.3.0 → 3.3.3

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 (75) hide show
  1. package/dist/billboard.css +1 -1
  2. package/dist/billboard.js +489 -399
  3. package/dist/billboard.min.css +1 -1
  4. package/dist/billboard.min.js +2 -2
  5. package/dist/billboard.pkgd.js +2491 -2239
  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 +166 -103
  10. package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
  11. package/dist/plugin/billboardjs-plugin-stanford.js +166 -103
  12. package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
  13. package/dist/plugin/billboardjs-plugin-tableview.js +32 -130
  14. package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
  15. package/dist/plugin/billboardjs-plugin-textoverlap.js +32 -130
  16. package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
  17. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.js +2004 -1842
  18. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.js +2168 -1943
  19. package/dist/plugin/pkgd/billboardjs-plugin-stanford.js +2170 -1945
  20. package/dist/plugin/pkgd/billboardjs-plugin-tableview.js +2036 -1972
  21. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.js +2037 -1973
  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 +481 -412
  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 +28 -28
  35. package/src/Chart/api/chart.ts +1 -1
  36. package/src/Chart/api/focus.ts +8 -8
  37. package/src/Chart/api/regions.ts +3 -3
  38. package/src/Chart/api/selection.ts +15 -15
  39. package/src/Chart/api/subchart.ts +10 -10
  40. package/src/ChartInternal/Axis/Axis.ts +16 -14
  41. package/src/ChartInternal/ChartInternal.ts +7 -8
  42. package/src/ChartInternal/data/data.ts +3 -3
  43. package/src/ChartInternal/data/load.ts +2 -2
  44. package/src/ChartInternal/interactions/drag.ts +15 -15
  45. package/src/ChartInternal/interactions/eventrect.ts +18 -18
  46. package/src/ChartInternal/interactions/interaction.ts +10 -10
  47. package/src/ChartInternal/interactions/zoom.ts +4 -4
  48. package/src/ChartInternal/internals/color.ts +4 -4
  49. package/src/ChartInternal/internals/domain.ts +1 -1
  50. package/src/ChartInternal/internals/format.ts +9 -4
  51. package/src/ChartInternal/internals/grid.ts +32 -32
  52. package/src/ChartInternal/internals/legend.ts +27 -27
  53. package/src/ChartInternal/internals/redraw.ts +6 -5
  54. package/src/ChartInternal/internals/region.ts +3 -3
  55. package/src/ChartInternal/internals/selection.ts +16 -15
  56. package/src/ChartInternal/internals/size.ts +3 -3
  57. package/src/ChartInternal/internals/text.ts +8 -8
  58. package/src/ChartInternal/internals/title.ts +4 -4
  59. package/src/ChartInternal/internals/tooltip.ts +5 -5
  60. package/src/ChartInternal/internals/transform.ts +5 -5
  61. package/src/ChartInternal/shape/arc.ts +22 -22
  62. package/src/ChartInternal/shape/area.ts +4 -4
  63. package/src/ChartInternal/shape/bar.ts +7 -7
  64. package/src/ChartInternal/shape/candlestick.ts +8 -8
  65. package/src/ChartInternal/shape/gauge.ts +8 -8
  66. package/src/ChartInternal/shape/line.ts +7 -7
  67. package/src/ChartInternal/shape/point.ts +18 -18
  68. package/src/ChartInternal/shape/radar.ts +10 -10
  69. package/src/ChartInternal/shape/shape.ts +4 -2
  70. package/src/Plugin/sparkline/index.ts +2 -2
  71. package/src/Plugin/stanford/index.ts +3 -3
  72. package/src/Plugin/stanford/util.ts +0 -1
  73. package/src/config/Options/common/tooltip.ts +10 -1
  74. package/src/config/classes.ts +154 -66
  75. package/src/module/util.ts +21 -13
@@ -7,7 +7,7 @@ import {
7
7
  namespaces as d3Namespaces
8
8
  } from "d3-selection";
9
9
  import {document} from "../../module/browser";
10
- import CLASS from "../../config/classes";
10
+ import {$FOCUS, $GAUGE, $LEGEND} from "../../config/classes";
11
11
  import {KEY} from "../../module/Cache";
12
12
  import {callFn, isDefined, getOption, isEmpty, isFunction, notEmpty, tplProcess} from "../../module/util";
13
13
 
@@ -26,7 +26,7 @@ export default {
26
26
  if (config.legend_show) {
27
27
  if (!config.legend_contents_bindto) {
28
28
  $el.legend = $$.$el.svg.append("g")
29
- .classed(CLASS.legend, true)
29
+ .classed($LEGEND.legend, true)
30
30
  .attr("transform", $$.getTranslate("legend"));
31
31
  }
32
32
 
@@ -68,8 +68,8 @@ export default {
68
68
  }
69
69
 
70
70
  // toggle legend state
71
- $el.legend.selectAll(`.${CLASS.legendItem}`)
72
- .classed(CLASS.legendItemHidden, function(id) {
71
+ $el.legend.selectAll(`.${$LEGEND.legendItem}`)
72
+ .classed($LEGEND.legendItemHidden, function(id) {
73
73
  const hide = !$$.isTargetToShow(id);
74
74
 
75
75
  if (hide) {
@@ -209,7 +209,7 @@ export default {
209
209
  const {legend} = this.$el;
210
210
 
211
211
  if (legend) {
212
- legend.select(`.${CLASS.legendItem}-${id} line`)
212
+ legend.select(`.${$LEGEND.legendItem}-${id} line`)
213
213
  .style("stroke", color);
214
214
  }
215
215
  },
@@ -251,7 +251,7 @@ export default {
251
251
  * @private
252
252
  */
253
253
  opacityForUnfocusedLegend(legendItem): string | null {
254
- return legendItem.classed(CLASS.legendItemHidden) ? null : "0.3";
254
+ return legendItem.classed($LEGEND.legendItemHidden) ? null : "0.3";
255
255
  },
256
256
 
257
257
  /**
@@ -265,9 +265,9 @@ export default {
265
265
  const {$el: {legend}, $T} = $$;
266
266
  const targetIdz = $$.mapToTargetIds(targetIds);
267
267
 
268
- legend && $T(legend.selectAll(`.${CLASS.legendItem}`)
268
+ legend && $T(legend.selectAll(`.${$LEGEND.legendItem}`)
269
269
  .filter(id => targetIdz.indexOf(id) >= 0)
270
- .classed(CLASS.legendItemFocused, focus))
270
+ .classed($FOCUS.legendItemFocused, focus))
271
271
  .style("opacity", function() {
272
272
  return focus ? null :
273
273
  $$.opacityForUnfocusedLegend.call($$, d3Select(this));
@@ -282,8 +282,8 @@ export default {
282
282
  const $$ = this;
283
283
  const {$el: {legend}, $T} = $$;
284
284
 
285
- legend && $T(legend.selectAll(`.${CLASS.legendItem}`)
286
- .classed(CLASS.legendItemFocused, false))
285
+ legend && $T(legend.selectAll(`.${$LEGEND.legendItem}`)
286
+ .classed($FOCUS.legendItemFocused, false))
287
287
  .style("opacity", null);
288
288
  },
289
289
 
@@ -353,7 +353,7 @@ export default {
353
353
  data = (!state.redrawing && cache.get(cacheKey)) || {};
354
354
 
355
355
  if (!data[id]) {
356
- data[id] = $$.getTextRect(textElement, CLASS.legendItem);
356
+ data[id] = $$.getTextRect(textElement, $LEGEND.legendItem);
357
357
  cache.add(cacheKey, data);
358
358
  }
359
359
 
@@ -379,7 +379,7 @@ export default {
379
379
  const node = d3Select(this);
380
380
  const itemClass = (!node.empty() && node.attr("class")) || "";
381
381
 
382
- return itemClass + $$.generateClass(CLASS.legendItem, id);
382
+ return itemClass + $$.generateClass($LEGEND.legendItem, id);
383
383
  })
384
384
  .style("visibility", id => ($$.isLegendToShow(id) ? null : "hidden"));
385
385
 
@@ -395,7 +395,7 @@ export default {
395
395
  api.toggle(id);
396
396
 
397
397
  d3Select(this)
398
- .classed(CLASS.legendItemFocused, false);
398
+ .classed($FOCUS.legendItemFocused, false);
399
399
  }
400
400
  }
401
401
 
@@ -405,10 +405,10 @@ export default {
405
405
  !isTouch && item
406
406
  .on("mouseout", function(event, id) {
407
407
  if (!callFn(config.legend_item_onout, api, id)) {
408
- d3Select(this).classed(CLASS.legendItemFocused, false);
408
+ d3Select(this).classed($FOCUS.legendItemFocused, false);
409
409
 
410
410
  if (hasGauge) {
411
- $$.undoMarkOverlapped($$, `.${CLASS.gaugeValue}`);
411
+ $$.undoMarkOverlapped($$, `.${$GAUGE.gaugeValue}`);
412
412
  }
413
413
 
414
414
  $$.api.revert();
@@ -416,10 +416,10 @@ export default {
416
416
  })
417
417
  .on("mouseover", function(event, id) {
418
418
  if (!callFn(config.legend_item_onover, api, id)) {
419
- d3Select(this).classed(CLASS.legendItemFocused, true);
419
+ d3Select(this).classed($FOCUS.legendItemFocused, true);
420
420
 
421
421
  if (hasGauge) {
422
- $$.markOverlapped(id, $$, `.${CLASS.gaugeValue}`);
422
+ $$.markOverlapped(id, $$, `.${$GAUGE.gaugeValue}`);
423
423
  }
424
424
 
425
425
  if (!state.transiting && $$.isTargetToShow(id)) {
@@ -567,7 +567,7 @@ export default {
567
567
  const pos = -200;
568
568
 
569
569
  // Define g for legend area
570
- const l = legend.selectAll(`.${CLASS.legendItem}`)
570
+ const l = legend.selectAll(`.${$LEGEND.legendItem}`)
571
571
  .data(targetIdz)
572
572
  .enter()
573
573
  .append("g");
@@ -584,7 +584,7 @@ export default {
584
584
  .attr("y", isLegendRightOrInset ? pos : yForLegendText);
585
585
 
586
586
  l.append("rect")
587
- .attr("class", CLASS.legendItemEvent)
587
+ .attr("class", $LEGEND.legendItemEvent)
588
588
  .style("fill-opacity", "0")
589
589
  .attr("x", isLegendRightOrInset ? xForLegendRect : pos)
590
590
  .attr("y", isLegendRightOrInset ? pos : yForLegendRect);
@@ -616,7 +616,7 @@ export default {
616
616
 
617
617
  return document.createElementNS(d3Namespaces.svg, ("hasValidPointType" in $$) && $$.hasValidPointType(point) ? point : "use");
618
618
  })
619
- .attr("class", CLASS.legendItemPoint)
619
+ .attr("class", $LEGEND.legendItemPoint)
620
620
  .style("fill", getColor)
621
621
  .style("pointer-events", "none")
622
622
  .attr("href", (data, idx, selection) => {
@@ -628,7 +628,7 @@ export default {
628
628
  });
629
629
  } else {
630
630
  l.append("line")
631
- .attr("class", CLASS.legendItemTile)
631
+ .attr("class", $LEGEND.legendItemTile)
632
632
  .style("stroke", getColor)
633
633
  .style("pointer-events", "none")
634
634
  .attr("x1", isLegendRightOrInset ? x1ForLegendTile : pos)
@@ -639,11 +639,11 @@ export default {
639
639
  }
640
640
 
641
641
  // Set background for inset legend
642
- background = legend.select(`.${CLASS.legendBackground} rect`);
642
+ background = legend.select(`.${$LEGEND.legendBackground} rect`);
643
643
 
644
644
  if (state.isLegendInset && maxWidth > 0 && background.size() === 0) {
645
- background = legend.insert("g", `.${CLASS.legendItem}`)
646
- .attr("class", CLASS.legendBackground)
645
+ background = legend.insert("g", `.${$LEGEND.legendItem}`)
646
+ .attr("class", $LEGEND.legendBackground)
647
647
  .append("rect");
648
648
  }
649
649
 
@@ -658,7 +658,7 @@ export default {
658
658
  .attr("x", xForLegendText)
659
659
  .attr("y", yForLegendText);
660
660
 
661
- const rects = legend.selectAll(`rect.${CLASS.legendItemEvent}`)
661
+ const rects = legend.selectAll(`rect.${$LEGEND.legendItemEvent}`)
662
662
  .data(targetIdz);
663
663
 
664
664
  $T(rects, withTransition)
@@ -668,7 +668,7 @@ export default {
668
668
  .attr("y", yForLegendRect);
669
669
 
670
670
  if (usePoint) {
671
- const tiles = legend.selectAll(`.${CLASS.legendItemPoint}`)
671
+ const tiles = legend.selectAll(`.${$LEGEND.legendItemPoint}`)
672
672
  .data(targetIdz);
673
673
 
674
674
  $T(tiles, withTransition)
@@ -707,7 +707,7 @@ export default {
707
707
  .attr("height", height);
708
708
  });
709
709
  } else {
710
- const tiles = legend.selectAll(`line.${CLASS.legendItemTile}`)
710
+ const tiles = legend.selectAll(`line.${$LEGEND.legendItemTile}`)
711
711
  .data(targetIdz);
712
712
 
713
713
  $T(tiles, withTransition)
@@ -3,7 +3,7 @@
3
3
  * billboard.js project is licensed under the MIT license
4
4
  */
5
5
  import {transition as d3Transition} from "d3-transition";
6
- import CLASS from "../../config/classes";
6
+ import {$COMMON, $SELECT, $TEXT} from "../../config/classes";
7
7
  import {generateWait} from "../../module/generator";
8
8
  import {callFn, capitalize, getOption, isTabVisible, notEmpty} from "../../module/util";
9
9
 
@@ -47,7 +47,7 @@ export default {
47
47
  $$.axis.redrawAxis(targetsToShow, wth, transitions, flow, initializing);
48
48
 
49
49
  // Data empty label positioning and text.
50
- config.data_empty_label_text && main.select(`text.${CLASS.text}.${CLASS.empty}`)
50
+ config.data_empty_label_text && main.select(`text.${$TEXT.text}.${$COMMON.empty}`)
51
51
  .attr("x", state.width / 2)
52
52
  .attr("y", state.height / 2)
53
53
  .text(config.data_empty_label_text)
@@ -69,7 +69,7 @@ export default {
69
69
 
70
70
 
71
71
  // circles for select
72
- $el.text && main.selectAll(`.${CLASS.selectedCircles}`)
72
+ $el.text && main.selectAll(`.${$SELECT.selectedCircles}`)
73
73
  .filter($$.isBarType.bind($$))
74
74
  .selectAll("circle")
75
75
  .remove();
@@ -246,10 +246,11 @@ export default {
246
246
  redrawWithoutRescale() {
247
247
  this.redraw({
248
248
  withY: false,
249
- withLegend: true,
249
+ withDimension: false,
250
+ withLegend: false,
250
251
  withSubchart: false,
251
252
  withEventRect: false,
252
- withTransitionForAxis: false
253
+ withTransitionForAxis: false,
253
254
  });
254
255
  }
255
256
  };
@@ -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