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
@@ -4,7 +4,7 @@
4
4
  */
5
5
  import {select as d3Select} from "d3-selection";
6
6
  import {d3Selection} from "../../../types/types";
7
- import CLASS from "../../config/classes";
7
+ import {$BAR, $CIRCLE, $COMMON, $DRAG, $SELECT, $SHAPE} from "../../config/classes";
8
8
  import {getPathBox} from "../../module/util";
9
9
 
10
10
  /**
@@ -39,30 +39,30 @@ export default {
39
39
  const minY = isSelectionGrouped ? state.margin.top : Math.min(sy, my);
40
40
  const maxY = isSelectionGrouped ? state.height : Math.max(sy, my);
41
41
 
42
- main.select(`.${CLASS.dragarea}`)
42
+ main.select(`.${$DRAG.dragarea}`)
43
43
  .attr("x", minX)
44
44
  .attr("y", minY)
45
45
  .attr("width", maxX - minX)
46
46
  .attr("height", maxY - minY);
47
47
 
48
48
  // TODO: binary search when multiple xs
49
- main.selectAll(`.${CLASS.shapes}`)
50
- .selectAll(`.${CLASS.shape}`)
49
+ main.selectAll(`.${$SHAPE.shapes}`)
50
+ .selectAll(`.${$SHAPE.shape}`)
51
51
  .filter(d => isSelectable?.bind($$.api)(d))
52
52
  .each(function(d, i) {
53
53
  const shape: d3Selection = d3Select(this);
54
- const isSelected = shape.classed(CLASS.SELECTED);
55
- const isIncluded = shape.classed(CLASS.INCLUDED);
54
+ const isSelected = shape.classed($SELECT.SELECTED);
55
+ const isIncluded = shape.classed($DRAG.INCLUDED);
56
56
  let isWithin: any = false;
57
57
  let toggle;
58
58
 
59
- if (shape.classed(CLASS.circle)) {
59
+ if (shape.classed($CIRCLE.circle)) {
60
60
  const x: number = +shape.attr("cx") * 1;
61
61
  const y: number = +shape.attr("cy") * 1;
62
62
 
63
63
  toggle = $$.togglePoint;
64
64
  isWithin = minX < x && x < maxX && minY < y && y < maxY;
65
- } else if (shape.classed(CLASS.bar)) {
65
+ } else if (shape.classed($BAR.bar)) {
66
66
  const {x, y, width, height} = getPathBox(this);
67
67
 
68
68
  toggle = $$.togglePath;
@@ -74,9 +74,9 @@ export default {
74
74
 
75
75
  // @ts-ignore
76
76
  if (isWithin ^ isIncluded) {
77
- shape.classed(CLASS.INCLUDED, !isIncluded);
77
+ shape.classed($DRAG.INCLUDED, !isIncluded);
78
78
  // TODO: included/unincluded callback here
79
- shape.classed(CLASS.SELECTED, !isSelected);
79
+ shape.classed($SELECT.SELECTED, !isSelected);
80
80
  toggle.call($$, !isSelected, shape, d, i);
81
81
  }
82
82
  });
@@ -98,9 +98,9 @@ export default {
98
98
 
99
99
  state.dragStart = mouse;
100
100
 
101
- main.select(`.${CLASS.chart}`)
101
+ main.select(`.${$COMMON.chart}`)
102
102
  .append("rect")
103
- .attr("class", CLASS.dragarea)
103
+ .attr("class", $DRAG.dragarea)
104
104
  .style("opacity", "0.1");
105
105
 
106
106
  $$.setDragStatus(true);
@@ -119,12 +119,12 @@ export default {
119
119
  return;
120
120
  }
121
121
 
122
- $T(main.select(`.${CLASS.dragarea}`))
122
+ $T(main.select(`.${$DRAG.dragarea}`))
123
123
  .style("opacity", "0")
124
124
  .remove();
125
125
 
126
- main.selectAll(`.${CLASS.shape}`)
127
- .classed(CLASS.INCLUDED, false);
126
+ main.selectAll(`.${$SHAPE.shape}`)
127
+ .classed($DRAG.INCLUDED, false);
128
128
 
129
129
  $$.setDragStatus(false);
130
130
  }
@@ -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 {$COMMON, $EVENT, $SHAPE} from "../../config/classes";
6
6
  import {isboolean, getPointer, isFunction} from "../../module/util";
7
7
 
8
8
  export default {
@@ -14,9 +14,9 @@ export default {
14
14
  initEventRect(): void {
15
15
  const $$ = this;
16
16
 
17
- $$.$el.main.select(`.${CLASS.chart}`)
17
+ $$.$el.main.select(`.${$COMMON.chart}`)
18
18
  .append("g")
19
- .attr("class", CLASS.eventRects)
19
+ .attr("class", $EVENT.eventRects)
20
20
  .style("fill-opacity", "0");
21
21
  },
22
22
 
@@ -32,15 +32,15 @@ export default {
32
32
  if ($el.eventRect) {
33
33
  $$.updateEventRect($el.eventRect, true);
34
34
  } else {
35
- const eventRects = $$.$el.main.select(`.${CLASS.eventRects}`)
35
+ const eventRects = $$.$el.main.select(`.${$EVENT.eventRects}`)
36
36
  .style("cursor", config.zoom_enabled && config.zoom_type !== "drag" ? (
37
37
  config.axis_rotated ? "ns-resize" : "ew-resize"
38
38
  ) : null)
39
- .classed(CLASS.eventRectsMultiple, isMultipleX)
40
- .classed(CLASS.eventRectsSingle, !isMultipleX);
39
+ .classed($EVENT.eventRectsMultiple, isMultipleX)
40
+ .classed($EVENT.eventRectsSingle, !isMultipleX);
41
41
 
42
42
  // append event <rect>
43
- const eventRectUpdate = eventRects.selectAll(`.${CLASS.eventRect}`)
43
+ const eventRectUpdate = eventRects.selectAll(`.${$EVENT.eventRect}`)
44
44
  .data([0])
45
45
  .enter()
46
46
  .append("rect");
@@ -139,7 +139,7 @@ export default {
139
139
  .on("touchstart.eventRect touchmove.eventRect", event => {
140
140
  state.event = event;
141
141
 
142
- if (!eventRect.empty() && eventRect.classed(CLASS.eventRect)) {
142
+ if (!eventRect.empty() && eventRect.classed($EVENT.eventRect)) {
143
143
  // if touch points are > 1, means doing zooming interaction. In this case do not execute tooltip codes.
144
144
  if (state.dragging || state.flowing || $$.hasArcType() || event.touches.length > 1) {
145
145
  return;
@@ -154,7 +154,7 @@ export default {
154
154
  .on("touchend.eventRect", event => {
155
155
  state.event = event;
156
156
 
157
- if (!eventRect.empty() && eventRect.classed(CLASS.eventRect)) {
157
+ if (!eventRect.empty() && eventRect.classed($EVENT.eventRect)) {
158
158
  if ($$.hasArcType() || !$$.toggleShape || state.cancelClick) {
159
159
  state.cancelClick && (state.cancelClick = false);
160
160
  }
@@ -199,7 +199,7 @@ export default {
199
199
 
200
200
  // only for init
201
201
  if (!rendered) {
202
- rectElement.attr("class", CLASS.eventRect);
202
+ rectElement.attr("class", $EVENT.eventRect);
203
203
  }
204
204
  }
205
205
 
@@ -334,7 +334,7 @@ export default {
334
334
 
335
335
  // Show cursor as pointer if point is close to mouse position
336
336
  if ($$.isBarType(closest.id) || $$.dist(closest, mouse) < config.point_sensitivity) {
337
- $$.$el.svg.select(`.${CLASS.eventRect}`).style("cursor", "pointer");
337
+ $$.$el.svg.select(`.${$EVENT.eventRect}`).style("cursor", "pointer");
338
338
 
339
339
  if (!state.mouseover) {
340
340
  config.data_onover.call($$.api, closest);
@@ -351,7 +351,7 @@ export default {
351
351
  const $$ = this;
352
352
  const {config, $el: {circle, tooltip}} = $$;
353
353
 
354
- $$.$el.svg.select(`.${CLASS.eventRect}`).style("cursor", null);
354
+ $$.$el.svg.select(`.${$EVENT.eventRect}`).style("cursor", null);
355
355
  $$.hideGridFocus();
356
356
 
357
357
  if (tooltip) {
@@ -366,8 +366,8 @@ export default {
366
366
  /**
367
367
  * Create eventRect for each data on the x-axis.
368
368
  * Register touch and drag events.
369
- * @param {object} eventRectEnter d3.select(CLASS.eventRects) object.
370
- * @returns {object} d3.select(CLASS.eventRects) object.
369
+ * @param {object} eventRectEnter d3.select($EVENT.eventRects) object.
370
+ * @returns {object} d3.select($EVENT.eventRects) object.
371
371
  * @private
372
372
  */
373
373
  generateEventRectsForSingleX(eventRectEnter) {
@@ -476,7 +476,7 @@ export default {
476
476
 
477
477
  const {index} = d;
478
478
 
479
- main.selectAll(`.${CLASS.shape}-${index}`)
479
+ main.selectAll(`.${$SHAPE.shape}-${index}`)
480
480
  .each(function(d2) {
481
481
  if (config.data_selection_grouped || $$.isWithinShape(this, d2)) {
482
482
  $$.toggleShape?.(this, d2, index);
@@ -488,7 +488,7 @@ export default {
488
488
  /**
489
489
  * Create an eventRect,
490
490
  * Register touch and drag events.
491
- * @param {object} eventRectEnter d3.select(CLASS.eventRects) object.
491
+ * @param {object} eventRectEnter d3.select($EVENT.eventRects) object.
492
492
  * @private
493
493
  */
494
494
  generateEventRectsForMultipleXs(eventRectEnter): void {
@@ -538,8 +538,8 @@ export default {
538
538
 
539
539
  // select if selection enabled
540
540
  if ($$.isBarType(closest.id) || $$.dist(closest, mouse) < config.point_sensitivity) {
541
- $$.$el.main.selectAll(`.${CLASS.shapes}${$$.getTargetSelectorSuffix(closest.id)}`)
542
- .selectAll(`.${CLASS.shape}-${closest.index}`)
541
+ $$.$el.main.selectAll(`.${$SHAPE.shapes}${$$.getTargetSelectorSuffix(closest.id)}`)
542
+ .selectAll(`.${$SHAPE.shape}-${closest.index}`)
543
543
  .each(function() {
544
544
  if (config.data_selection_grouped || $$.isWithinShape(this, closest)) {
545
545
  $$.toggleShape?.(this, closest, closest.index);
@@ -4,7 +4,7 @@
4
4
  */
5
5
  import {select as d3Select} from "d3-selection";
6
6
  import {drag as d3Drag} from "d3-drag";
7
- import CLASS from "../../config/classes";
7
+ import {$ARC, $AXIS, $COMMON, $SHAPE} from "../../config/classes";
8
8
  import {KEY} from "../../module/Cache";
9
9
  import {emulateEvent, getPointer, isNumber, isObject} from "../../module/util";
10
10
 
@@ -27,9 +27,9 @@ export default {
27
27
  }
28
28
  }
29
29
 
30
- main.selectAll(`.${CLASS.shape}-${index}`)
30
+ main.selectAll(`.${$SHAPE.shape}-${index}`)
31
31
  .each(function() {
32
- d3Select(this).classed(CLASS.EXPANDED, true);
32
+ d3Select(this).classed($COMMON.EXPANDED, true);
33
33
 
34
34
  if (isSelectionEnabled) {
35
35
  eventRect.style("cursor", isSelectionGrouped ? "pointer" : null);
@@ -96,8 +96,8 @@ export default {
96
96
  ["bar", "candlestick"]
97
97
  .filter(v => $$.$el[v])
98
98
  .forEach(v => {
99
- reset && $$.$el[v].classed(CLASS.EXPANDED, false);
100
- $$.getShapeByIndex(v, i, id).classed(CLASS.EXPANDED, expand);
99
+ reset && $$.$el[v].classed($COMMON.EXPANDED, false);
100
+ $$.getShapeByIndex(v, i, id).classed($COMMON.EXPANDED, expand);
101
101
  });
102
102
  },
103
103
 
@@ -119,11 +119,11 @@ export default {
119
119
  config.color_onover && $$.setOverColor(isOver, d, isArc);
120
120
 
121
121
  if (isArc) {
122
- callback(d, main.select(`.${CLASS.arc}${$$.getTargetSelectorSuffix(d.id)}`).node());
122
+ callback(d, main.select(`.${$ARC.arc}${$$.getTargetSelectorSuffix(d.id)}`).node());
123
123
  } else if (!config.tooltip_grouped) {
124
124
  let last = $$.cache.get(KEY.setOverOut) || [];
125
125
 
126
- const shape = main.selectAll(`.${CLASS.shape}-${d}`)
126
+ const shape = main.selectAll(`.${$SHAPE.shape}-${d}`)
127
127
  .filter(function(d) {
128
128
  return $$.isWithinShape(this, d);
129
129
  });
@@ -151,7 +151,7 @@ export default {
151
151
  $$.setExpand(d, null, true);
152
152
  }
153
153
 
154
- !$$.isMultipleX() && main.selectAll(`.${CLASS.shape}-${d}`)
154
+ !$$.isMultipleX() && main.selectAll(`.${$SHAPE.shape}-${d}`)
155
155
  .each(function(d) {
156
156
  callback(d, this);
157
157
  });
@@ -213,8 +213,8 @@ export default {
213
213
  const {config, state: {eventReceiver, hasAxis, hasRadar}, $el: {eventRect, arcs, radar}} = $$;
214
214
  const isMultipleX = $$.isMultipleX();
215
215
  const element = (
216
- hasRadar ? radar.axes.select(`.${CLASS.axis}-${index} text`) : (
217
- eventRect || arcs.selectAll(`.${CLASS.target} path`).filter((d, i) => i === index)
216
+ hasRadar ? radar.axes.select(`.${$AXIS.axis}-${index} text`) : (
217
+ eventRect || arcs.selectAll(`.${$COMMON.target} path`).filter((d, i) => i === index)
218
218
  )
219
219
  ).node();
220
220
 
@@ -4,7 +4,7 @@
4
4
  */
5
5
  import {drag as d3Drag} from "d3-drag";
6
6
  import {zoomIdentity as d3ZoomIdentity, zoom as d3Zoom} from "d3-zoom";
7
- import CLASS from "../../config/classes";
7
+ import {$COMMON, $ZOOM} from "../../config/classes";
8
8
  import {callFn, diffDomain, getPointer, isFunction} from "../../module/util";
9
9
 
10
10
  export default {
@@ -301,7 +301,7 @@ export default {
301
301
  if (!zoomRect) {
302
302
  zoomRect = $$.$el.main.append("rect")
303
303
  .attr("clip-path", state.clip.path)
304
- .attr("class", CLASS.zoomBrush)
304
+ .attr("class", $ZOOM.zoomBrush)
305
305
  .attr("width", isRotated ? state.width : 0)
306
306
  .attr("height", isRotated ? 0 : state.height);
307
307
  }
@@ -356,13 +356,13 @@ export default {
356
356
  if (resetButton && config.zoom_type === "drag") {
357
357
  if (!$el.zoomResetBtn) {
358
358
  $el.zoomResetBtn = $$.$el.chart.append("div")
359
- .classed(CLASS.button, true)
359
+ .classed($COMMON.button, true)
360
360
  .append("span")
361
361
  .on("click", function() {
362
362
  isFunction(resetButton.onclick) && resetButton.onclick.bind($$.api)(this);
363
363
  $$.api.unzoom();
364
364
  })
365
- .classed(CLASS.buttonZoomReset, true)
365
+ .classed($ZOOM.buttonZoomReset, true)
366
366
  .text(resetButton.text || "Reset Zoom");
367
367
  } else {
368
368
  $el.zoomResetBtn.style("display", null);
@@ -5,7 +5,7 @@
5
5
  import {select as d3Select} from "d3-selection";
6
6
  import {scaleOrdinal as d3ScaleOrdinal} from "d3-scale";
7
7
  import {document, window} from "../../module/browser";
8
- import CLASS from "../../config/classes";
8
+ import {$ARC, $COLOR, $SHAPE} from "../../config/classes";
9
9
  import {KEY} from "../../module/Cache";
10
10
  import {notEmpty, isFunction, isObject, isString} from "../../module/util";
11
11
 
@@ -54,7 +54,7 @@ export default {
54
54
  const delimiter = ";";
55
55
  const span = document.createElement("span");
56
56
 
57
- span.className = CLASS.colorPattern;
57
+ span.className = $COLOR.colorPattern;
58
58
  span.style.display = "none";
59
59
  body.appendChild(span);
60
60
 
@@ -214,8 +214,8 @@ export default {
214
214
  main.selectAll(
215
215
  isObject(d) ?
216
216
  // when is Arc type
217
- `.${CLASS.arc}${$$.getTargetSelectorSuffix(d.id)}` :
218
- `.${CLASS.shape}-${d}`
217
+ `.${$ARC.arc}${$$.getTargetSelectorSuffix(d.id)}` :
218
+ `.${$SHAPE.shape}-${d}`
219
219
  ).style("fill", color);
220
220
  }
221
221
  };
@@ -109,7 +109,7 @@ export default {
109
109
  .some(v => {
110
110
  const type = v.indexOf("area") > -1 ? "area" : v;
111
111
 
112
- return $$.hasType(v, yTargets) && config[`${type}_zerobased`];
112
+ return $$.hasType(v, yTargets, true) && config[`${type}_zerobased`];
113
113
  });
114
114
 
115
115
  // MEMO: avoid inverting domain unexpectedly
@@ -38,11 +38,16 @@ export default {
38
38
  */
39
39
  getDefaultValueFormat(): Function {
40
40
  const $$ = this;
41
- const hasArc = $$.hasArcType();
41
+ const {defaultArcValueFormat, yFormat, y2Format} = $$;
42
+ const hasArc = $$.hasArcType(null, ["gauge", "radar"]);
42
43
 
43
- return hasArc && !$$.hasType("gauge") ?
44
- $$.defaultArcValueFormat :
45
- $$.defaultValueFormat;
44
+ return function(v, ratio, id) {
45
+ const format = hasArc ? defaultArcValueFormat : (
46
+ $$.axis && $$.axis.getId(id) === "y2" ? y2Format : yFormat
47
+ );
48
+
49
+ return format.call($$, v, ratio);
50
+ };
46
51
  },
47
52
 
48
53
  defaultValueFormat(v): number|string {
@@ -6,7 +6,7 @@ import {
6
6
  select as d3Select,
7
7
  selectAll as d3SelectAll
8
8
  } from "d3-selection";
9
- import CLASS from "../../config/classes";
9
+ import {$AXIS, $COMMON, $FOCUS, $GRID} from "../../config/classes";
10
10
  import {isArray, isValue} from "../../module/util";
11
11
 
12
12
  // Grid position and text anchor helpers
@@ -72,12 +72,12 @@ export default {
72
72
  const {config, state: {clip}, $el} = $$;
73
73
 
74
74
  if (config.grid_x_lines.length || config.grid_y_lines.length) {
75
- $el.gridLines.main = $el.main.insert("g", `.${CLASS.chart}${config.grid_lines_front ? " + *" : ""}`)
75
+ $el.gridLines.main = $el.main.insert("g", `.${$COMMON.chart}${config.grid_lines_front ? " + *" : ""}`)
76
76
  .attr("clip-path", clip.pathGrid)
77
- .attr("class", `${CLASS.grid} ${CLASS.gridLines}`);
77
+ .attr("class", `${$GRID.grid} ${$GRID.gridLines}`);
78
78
 
79
- $el.gridLines.main.append("g").attr("class", CLASS.xgridLines);
80
- $el.gridLines.main.append("g").attr("class", CLASS.ygridLines);
79
+ $el.gridLines.main.append("g").attr("class", $GRID.xgridLines);
80
+ $el.gridLines.main.append("g").attr("class", $GRID.ygridLines);
81
81
 
82
82
  $el.gridLines.x = d3SelectAll([]);
83
83
  }
@@ -105,15 +105,15 @@ export default {
105
105
  "y2": state.height,
106
106
  };
107
107
 
108
- grid.x = main.select(`.${CLASS.xgrids}`)
109
- .selectAll(`.${CLASS.xgrid}`)
108
+ grid.x = main.select(`.${$GRID.xgrids}`)
109
+ .selectAll(`.${$GRID.xgrid}`)
110
110
  .data(xgridData);
111
111
 
112
112
  grid.x.exit().remove();
113
113
 
114
114
  grid.x = grid.x.enter()
115
115
  .append("line")
116
- .attr("class", CLASS.xgrid)
116
+ .attr("class", $GRID.xgrid)
117
117
  .merge(grid.x);
118
118
 
119
119
  if (!withoutUpdate) {
@@ -138,8 +138,8 @@ export default {
138
138
  const gridValues = $$.axis.y.tickValues() || $$.scale.y.ticks(config.grid_y_ticks);
139
139
  const pos = d => Math.ceil($$.scale.y(d));
140
140
 
141
- grid.y = main.select(`.${CLASS.ygrids}`)
142
- .selectAll(`.${CLASS.ygrid}`)
141
+ grid.y = main.select(`.${$GRID.ygrids}`)
142
+ .selectAll(`.${$GRID.ygrid}`)
143
143
  .data(gridValues);
144
144
 
145
145
  grid.y.exit().remove();
@@ -147,7 +147,7 @@ export default {
147
147
  grid.y = grid.y
148
148
  .enter()
149
149
  .append("line")
150
- .attr("class", CLASS.ygrid)
150
+ .attr("class", $GRID.ygrid)
151
151
  .merge(grid.y);
152
152
 
153
153
  grid.y.attr("x1", isRotated ? pos : 0)
@@ -183,8 +183,8 @@ export default {
183
183
 
184
184
  config.grid_x_show && $$.updateXGrid();
185
185
 
186
- let xLines = main.select(`.${CLASS.xgridLines}`)
187
- .selectAll(`.${CLASS.xgridLine}`)
186
+ let xLines = main.select(`.${$GRID.xgridLines}`)
187
+ .selectAll(`.${$GRID.xgridLine}`)
188
188
  .data(config.grid_x_lines);
189
189
 
190
190
  // exit
@@ -206,7 +206,7 @@ export default {
206
206
  xLines = xgridLine.merge(xLines);
207
207
 
208
208
  $T(xLines
209
- .attr("class", d => `${CLASS.xgridLine} ${d.class || ""}`.trim())
209
+ .attr("class", d => `${$GRID.xgridLine} ${d.class || ""}`.trim())
210
210
  .select("text")
211
211
  .attr("text-anchor", getGridTextAnchor)
212
212
  .attr("dx", getGridTextDx)
@@ -228,8 +228,8 @@ export default {
228
228
 
229
229
  config.grid_y_show && $$.updateYGrid();
230
230
 
231
- let ygridLines = $el.main.select(`.${CLASS.ygridLines}`)
232
- .selectAll(`.${CLASS.ygridLine}`)
231
+ let ygridLines = $el.main.select(`.${$GRID.ygridLines}`)
232
+ .selectAll(`.${$GRID.ygridLine}`)
233
233
  .data(config.grid_y_lines);
234
234
 
235
235
  // exit
@@ -253,7 +253,7 @@ export default {
253
253
  const yv = $$.yv.bind($$);
254
254
 
255
255
  $T(ygridLines
256
- .attr("class", d => `${CLASS.ygridLine} ${d.class || ""}`.trim())
256
+ .attr("class", d => `${$GRID.ygridLine} ${d.class || ""}`.trim())
257
257
  .select("line"))
258
258
  .attr("x1", isRotated ? yv : 0)
259
259
  .attr("x2", isRotated ? yv : width)
@@ -307,32 +307,32 @@ export default {
307
307
  const $$ = this;
308
308
  const {config, state: {clip}, $el} = $$;
309
309
  const isFront = config.grid_front;
310
- const className = `.${CLASS[isFront && $el.gridLines.main ? "gridLines" : "chart"]}${isFront ? " + *" : ""}`;
310
+ const className = `.${isFront && $el.gridLines.main ? $GRID.gridLines : $COMMON.chart}${isFront ? " + *" : ""}`;
311
311
 
312
312
  const grid = $el.main.insert("g", className)
313
313
  .attr("clip-path", clip.pathGrid)
314
- .attr("class", CLASS.grid);
314
+ .attr("class", $GRID.grid);
315
315
 
316
316
  $el.grid.main = grid;
317
317
 
318
318
  config.grid_x_show &&
319
- grid.append("g").attr("class", CLASS.xgrids);
319
+ grid.append("g").attr("class", $GRID.xgrids);
320
320
 
321
321
  config.grid_y_show &&
322
- grid.append("g").attr("class", CLASS.ygrids);
322
+ grid.append("g").attr("class", $GRID.ygrids);
323
323
 
324
324
  if (config.interaction_enabled && config.grid_focus_show) {
325
325
  grid.append("g")
326
- .attr("class", CLASS.xgridFocus)
326
+ .attr("class", $FOCUS.xgridFocus)
327
327
  .append("line")
328
- .attr("class", CLASS.xgridFocus);
328
+ .attr("class", $FOCUS.xgridFocus);
329
329
 
330
330
  // to show xy focus grid line, should be 'tooltip.grouped=false'
331
331
  if (config.grid_focus_y && !config.tooltip_grouped) {
332
332
  grid.append("g")
333
- .attr("class", CLASS.ygridFocus)
333
+ .attr("class", $FOCUS.ygridFocus)
334
334
  .append("line")
335
- .attr("class", CLASS.ygridFocus);
335
+ .attr("class", $FOCUS.ygridFocus);
336
336
  }
337
337
  }
338
338
  },
@@ -346,7 +346,7 @@ export default {
346
346
  const $$ = this;
347
347
  const {config, state: {width, height}} = $$;
348
348
  const isRotated = config.axis_rotated;
349
- const focusEl = $$.$el.main.selectAll(`line.${CLASS.xgridFocus}, line.${CLASS.ygridFocus}`);
349
+ const focusEl = $$.$el.main.selectAll(`line.${$FOCUS.xgridFocus}, line.${$FOCUS.ygridFocus}`);
350
350
 
351
351
  const dataToShow = (data || [focusEl.datum()]).filter(d => d && isValue($$.getBaseValue(d)));
352
352
 
@@ -369,7 +369,7 @@ export default {
369
369
  };
370
370
  let xy;
371
371
 
372
- if (el.classed(CLASS.xgridFocus)) {
372
+ if (el.classed($FOCUS.xgridFocus)) {
373
373
  // will contain 'x1, y1, x2, y2' order
374
374
  xy = isRotated ?
375
375
  [
@@ -413,7 +413,7 @@ export default {
413
413
  const {state: {inputType, resizing}, $el: {main}} = $$;
414
414
 
415
415
  if (inputType === "mouse" || !resizing) {
416
- main.selectAll(`line.${CLASS.xgridFocus}, line.${CLASS.ygridFocus}`)
416
+ main.selectAll(`line.${$FOCUS.xgridFocus}, line.${$FOCUS.ygridFocus}`)
417
417
  .style("visibility", "hidden");
418
418
 
419
419
  $$.hideCircleFocus?.();
@@ -423,7 +423,7 @@ export default {
423
423
  updateGridFocus(): boolean {
424
424
  const $$ = this;
425
425
  const {state: {inputType, width, height, resizing}, $el: {grid}} = $$;
426
- const xgridFocus = grid.main.select(`line.${CLASS.xgridFocus}`);
426
+ const xgridFocus = grid.main.select(`line.${$FOCUS.xgridFocus}`);
427
427
 
428
428
  if (inputType === "touch") {
429
429
  if (xgridFocus.empty()) {
@@ -448,7 +448,7 @@ export default {
448
448
 
449
449
  generateGridData(type: string, scale) {
450
450
  const $$ = this;
451
- const tickNum = $$.$el.main.select(`.${CLASS.axisX}`)
451
+ const tickNum = $$.$el.main.select(`.${$AXIS.axisX}`)
452
452
  .selectAll(".tick")
453
453
  .size();
454
454
  let gridData: Date[] = [];
@@ -490,8 +490,8 @@ export default {
490
490
  const {config, $T} = $$;
491
491
  const toRemove = $$.getGridFilterToRemove(params);
492
492
  const toShow = line => !toRemove(line);
493
- const classLines = forX ? CLASS.xgridLines : CLASS.ygridLines;
494
- const classLine = forX ? CLASS.xgridLine : CLASS.ygridLine;
493
+ const classLines = forX ? $GRID.xgridLines : $GRID.ygridLines;
494
+ const classLine = forX ? $GRID.xgridLine : $GRID.ygridLine;
495
495
 
496
496
  $T($$.$el.main.select(`.${classLines}`)
497
497
  .selectAll(`.${classLine}`)