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.
- package/dist/billboard.css +1 -1
- package/dist/billboard.js +424 -374
- package/dist/billboard.min.css +1 -1
- package/dist/billboard.min.js +2 -2
- package/dist/billboard.pkgd.js +2284 -2200
- package/dist/billboard.pkgd.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-bubblecompare.js +2 -2
- package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-sparkline.js +137 -92
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-stanford.js +138 -93
- package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-tableview.js +3 -119
- package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-textoverlap.js +3 -119
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.js +1862 -1828
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.js +1998 -1919
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.js +2000 -1921
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.js +1866 -1948
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.js +1866 -1948
- package/dist/theme/datalab.css +1 -1
- package/dist/theme/datalab.min.css +2 -2
- package/dist/theme/graph.css +1 -1
- package/dist/theme/graph.min.css +2 -2
- package/dist/theme/insight.css +1 -1
- package/dist/theme/insight.min.css +2 -2
- package/dist-esm/billboard.js +426 -383
- package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -4
- package/dist-esm/plugin/billboardjs-plugin-sparkline.js +129 -77
- package/dist-esm/plugin/billboardjs-plugin-stanford.js +135 -80
- package/dist-esm/plugin/billboardjs-plugin-tableview.js +4 -8
- package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +4 -7
- package/package.json +15 -15
- package/src/Chart/api/focus.ts +8 -8
- package/src/Chart/api/regions.ts +3 -3
- package/src/Chart/api/selection.ts +15 -15
- package/src/Chart/api/subchart.ts +3 -3
- package/src/ChartInternal/Axis/Axis.ts +13 -12
- package/src/ChartInternal/ChartInternal.ts +5 -6
- package/src/ChartInternal/data/data.ts +3 -3
- package/src/ChartInternal/data/load.ts +2 -2
- package/src/ChartInternal/interactions/drag.ts +15 -15
- package/src/ChartInternal/interactions/eventrect.ts +18 -18
- package/src/ChartInternal/interactions/interaction.ts +10 -10
- package/src/ChartInternal/interactions/zoom.ts +4 -4
- package/src/ChartInternal/internals/color.ts +4 -4
- package/src/ChartInternal/internals/domain.ts +1 -1
- package/src/ChartInternal/internals/grid.ts +32 -32
- package/src/ChartInternal/internals/legend.ts +27 -27
- package/src/ChartInternal/internals/redraw.ts +3 -3
- package/src/ChartInternal/internals/region.ts +3 -3
- package/src/ChartInternal/internals/selection.ts +16 -15
- package/src/ChartInternal/internals/size.ts +3 -3
- package/src/ChartInternal/internals/text.ts +8 -8
- package/src/ChartInternal/internals/title.ts +4 -4
- package/src/ChartInternal/internals/tooltip.ts +5 -5
- package/src/ChartInternal/internals/transform.ts +5 -5
- package/src/ChartInternal/shape/arc.ts +22 -22
- package/src/ChartInternal/shape/area.ts +4 -4
- package/src/ChartInternal/shape/bar.ts +7 -7
- package/src/ChartInternal/shape/candlestick.ts +8 -8
- package/src/ChartInternal/shape/gauge.ts +8 -8
- package/src/ChartInternal/shape/line.ts +7 -7
- package/src/ChartInternal/shape/point.ts +18 -18
- package/src/ChartInternal/shape/radar.ts +10 -10
- package/src/ChartInternal/shape/shape.ts +4 -2
- package/src/Plugin/sparkline/index.ts +2 -2
- package/src/Plugin/stanford/index.ts +3 -3
- package/src/Plugin/stanford/util.ts +0 -1
- package/src/config/classes.ts +154 -66
- 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
|
|
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",
|
|
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(`.${
|
|
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
|
|
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(`.${
|
|
32
|
-
.selectAll(`.${
|
|
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(
|
|
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(`.${
|
|
59
|
-
.selectAll(`.${
|
|
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 = `.${
|
|
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(`.${
|
|
170
|
+
.selectAll(`.${$SHAPE.shape}`)
|
|
170
171
|
.each(function(d, i) {
|
|
171
172
|
const shape = d3Select(this);
|
|
172
173
|
|
|
173
|
-
if (shape.classed(
|
|
174
|
+
if (shape.classed($SELECT.SELECTED)) {
|
|
174
175
|
toggledShape = shape;
|
|
175
|
-
toggle(false, shape.classed(
|
|
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(
|
|
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
|
|
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 ?
|
|
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(`.${
|
|
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
|
|
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(`.${
|
|
32
|
-
.attr("class",
|
|
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(`.${
|
|
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(`.${
|
|
69
|
-
.selectAll(`.${
|
|
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(
|
|
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(
|
|
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
|
|
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",
|
|
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,
|
|
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,
|
|
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
|
|
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",
|
|
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:
|
|
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.${
|
|
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:
|
|
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
|
|
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(`.${
|
|
63
|
+
$T(main.select(`.${$AXIS.axisX}`), withTransition);
|
|
64
64
|
|
|
65
65
|
const yAxis = transitions?.axisY ?
|
|
66
66
|
transitions.axisY :
|
|
67
|
-
$T(main.select(`.${
|
|
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(`.${
|
|
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(`.${
|
|
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
|
|
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(`.${
|
|
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, `.${
|
|
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, `.${
|
|
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(`${
|
|
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(`.${
|
|
488
|
+
const chartArcs = $el.main.select(`.${$ARC.chartArcs}`);
|
|
489
489
|
|
|
490
490
|
const mainPieUpdate = chartArcs
|
|
491
|
-
.selectAll(`.${
|
|
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(`.${
|
|
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(`.${
|
|
517
|
+
$el.arcs = $el.main.select(`.${$COMMON.chart}`)
|
|
518
518
|
.append("g")
|
|
519
|
-
.attr("class",
|
|
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",
|
|
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(`.${
|
|
552
|
-
.selectAll(`.${
|
|
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" : ""}.${
|
|
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.${
|
|
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) => `${
|
|
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(`.${
|
|
823
|
+
text = main.selectAll(`.${$ARC.chartArc}`)
|
|
824
824
|
.select("text")
|
|
825
825
|
.style("opacity", "0")
|
|
826
|
-
.attr("class", d => ($$.isGaugeType(d.data) ?
|
|
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(`.${
|
|
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(`.${
|
|
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(`.${
|
|
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(`.${
|
|
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
|
|
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", `.${
|
|
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(`.${
|
|
76
|
-
.selectAll(`.${
|
|
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
|
|
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(`.${
|
|
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",
|
|
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(`.${
|
|
43
|
-
.selectAll(`.${
|
|
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(`.${
|
|
77
|
-
.selectAll(`.${
|
|
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
|
|
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(`.${
|
|
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",
|
|
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(`.${
|
|
44
|
-
.selectAll(`.${
|
|
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(`.${
|
|
67
|
-
.selectAll(`.${
|
|
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(
|
|
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
|
|
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",
|
|
24
|
+
.attr("class", $ARC.chartArcsBackground)
|
|
25
25
|
.style("fill", (!hasMulti && config.gauge_background) || null);
|
|
26
26
|
|
|
27
|
-
config.gauge_units && appendText(
|
|
27
|
+
config.gauge_units && appendText($GAUGE.chartArcsGaugeUnit);
|
|
28
28
|
|
|
29
29
|
if (config.gauge_label_show) {
|
|
30
|
-
appendText(
|
|
31
|
-
!config.gauge_fullCircle && appendText(
|
|
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(`.${
|
|
57
|
-
.selectAll(`.${
|
|
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 => `${
|
|
62
|
+
.attr("class", d => `${$ARC.arcLabelLine} ${$COMMON.target} ${$COMMON.target}-${d.data.id}`)
|
|
63
63
|
.merge(arcLabelLines);
|
|
64
64
|
|
|
65
65
|
mainArcLabelLine
|