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.
- package/dist/billboard.css +1 -1
- package/dist/billboard.js +489 -399
- package/dist/billboard.min.css +1 -1
- package/dist/billboard.min.js +2 -2
- package/dist/billboard.pkgd.js +2491 -2239
- 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 +166 -103
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-stanford.js +166 -103
- package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-tableview.js +32 -130
- package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-textoverlap.js +32 -130
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.js +2004 -1842
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.js +2168 -1943
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.js +2170 -1945
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.js +2036 -1972
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.js +2037 -1973
- 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 +481 -412
- 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 +28 -28
- package/src/Chart/api/chart.ts +1 -1
- 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 +10 -10
- package/src/ChartInternal/Axis/Axis.ts +16 -14
- package/src/ChartInternal/ChartInternal.ts +7 -8
- 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/format.ts +9 -4
- package/src/ChartInternal/internals/grid.ts +32 -32
- package/src/ChartInternal/internals/legend.ts +27 -27
- package/src/ChartInternal/internals/redraw.ts +6 -5
- 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/Options/common/tooltip.ts +10 -1
- package/src/config/classes.ts +154 -66
- package/src/module/util.ts +21 -13
|
@@ -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
|
|
@@ -4,15 +4,15 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import {line as d3Line} from "d3-shape";
|
|
6
6
|
import {getScale} from "../internals/scale";
|
|
7
|
-
import
|
|
7
|
+
import {$COMMON, $LINE} from "../../config/classes";
|
|
8
8
|
import {getPointer, getRandom, isArray, isDefined, isUndefined, isValue, parseDate} from "../../module/util";
|
|
9
9
|
|
|
10
10
|
export default {
|
|
11
11
|
initLine(): void {
|
|
12
12
|
const {$el} = this;
|
|
13
13
|
|
|
14
|
-
$el.line = $el.main.select(`.${
|
|
15
|
-
.attr("class",
|
|
14
|
+
$el.line = $el.main.select(`.${$COMMON.chart}`).append("g")
|
|
15
|
+
.attr("class", $LINE.chartLines);
|
|
16
16
|
},
|
|
17
17
|
|
|
18
18
|
updateTargetsForLine(t): void {
|
|
@@ -28,8 +28,8 @@ export default {
|
|
|
28
28
|
|
|
29
29
|
const targets = t.filter(d => !($$.isScatterType(d) || $$.isBubbleType(d)));
|
|
30
30
|
|
|
31
|
-
const mainLineUpdate = main.select(`.${
|
|
32
|
-
.selectAll(`.${
|
|
31
|
+
const mainLineUpdate = main.select(`.${$LINE.chartLines}`)
|
|
32
|
+
.selectAll(`.${$LINE.chartLine}`)
|
|
33
33
|
.data(targets)
|
|
34
34
|
.attr("class", d => classChartLine(d) + classFocus(d));
|
|
35
35
|
|
|
@@ -62,8 +62,8 @@ export default {
|
|
|
62
62
|
const $root = isSub ? $el.subchart : $el;
|
|
63
63
|
|
|
64
64
|
const line = $root.main
|
|
65
|
-
.selectAll(`.${
|
|
66
|
-
.selectAll(`.${
|
|
65
|
+
.selectAll(`.${$LINE.lines}`)
|
|
66
|
+
.selectAll(`.${$LINE.line}`)
|
|
67
67
|
.data($$.lineData.bind($$));
|
|
68
68
|
|
|
69
69
|
$T(line.exit(), withTransition)
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
select as d3Select
|
|
8
8
|
} from "d3-selection";
|
|
9
9
|
import {d3Selection} from "../../../types/types";
|
|
10
|
-
import
|
|
10
|
+
import {$CIRCLE, $COMMON, $SELECT} from "../../config/classes";
|
|
11
11
|
import {document} from "../../module/browser";
|
|
12
12
|
import {getBoundingRect, getPointer, getRandom, isFunction, isObject, isObjectType, isUndefined, isValue, toArray, notEmpty} from "../../module/util";
|
|
13
13
|
|
|
@@ -58,10 +58,10 @@ export default {
|
|
|
58
58
|
|
|
59
59
|
$$.point = $$.generatePoint();
|
|
60
60
|
|
|
61
|
-
if (($$.hasType("bubble") || $$.hasType("scatter")) && main.select(`.${
|
|
62
|
-
main.select(`.${
|
|
61
|
+
if (($$.hasType("bubble") || $$.hasType("scatter")) && main.select(`.${$CIRCLE.chartCircles}`).empty()) {
|
|
62
|
+
main.select(`.${$COMMON.chart}`)
|
|
63
63
|
.append("g")
|
|
64
|
-
.attr("class",
|
|
64
|
+
.attr("class", $CIRCLE.chartCircles);
|
|
65
65
|
}
|
|
66
66
|
},
|
|
67
67
|
|
|
@@ -86,9 +86,9 @@ export default {
|
|
|
86
86
|
targets = (data.targets)
|
|
87
87
|
.filter(d => this.isScatterType(d) || this.isBubbleType(d));
|
|
88
88
|
|
|
89
|
-
const mainCircle = $el.main.select(`.${
|
|
89
|
+
const mainCircle = $el.main.select(`.${$CIRCLE.chartCircles}`)
|
|
90
90
|
.style("pointer-events", "none")
|
|
91
|
-
.selectAll(`.${
|
|
91
|
+
.selectAll(`.${$CIRCLE.circles}`)
|
|
92
92
|
.data(targets)
|
|
93
93
|
.attr("class", classCircles);
|
|
94
94
|
|
|
@@ -98,7 +98,7 @@ export default {
|
|
|
98
98
|
|
|
99
99
|
// Circles for each data point on lines
|
|
100
100
|
selectionEnabled && enterNode.append("g")
|
|
101
|
-
.attr("class", d => $$.generateClass(
|
|
101
|
+
.attr("class", d => $$.generateClass($SELECT.selectedCircles, d.id));
|
|
102
102
|
|
|
103
103
|
enterNode.append("g")
|
|
104
104
|
.attr("class", classCircles)
|
|
@@ -106,8 +106,8 @@ export default {
|
|
|
106
106
|
|
|
107
107
|
// Update date for selected circles
|
|
108
108
|
selectionEnabled && targets.forEach(t => {
|
|
109
|
-
$el.main.selectAll(`.${
|
|
110
|
-
.selectAll(`${
|
|
109
|
+
$el.main.selectAll(`.${$SELECT.selectedCircles}${$$.getTargetSelectorSuffix(t.id)}`)
|
|
110
|
+
.selectAll(`${$SELECT.selectedCircle}`)
|
|
111
111
|
.each(d => {
|
|
112
112
|
d.value = t.values[d.index].value;
|
|
113
113
|
});
|
|
@@ -121,8 +121,8 @@ export default {
|
|
|
121
121
|
const $root = isSub ? $el.subchart : $el;
|
|
122
122
|
|
|
123
123
|
if (config.point_show && !state.toggling) {
|
|
124
|
-
const circles = $root.main.selectAll(`.${
|
|
125
|
-
.selectAll(`.${
|
|
124
|
+
const circles = $root.main.selectAll(`.${$CIRCLE.circles}`)
|
|
125
|
+
.selectAll(`.${$CIRCLE.circle}`)
|
|
126
126
|
.data(d => (
|
|
127
127
|
($$.isLineType(d) && $$.shouldDrawPointsForLine(d)) ||
|
|
128
128
|
$$.isBubbleType(d) || $$.isRadarType(d) || $$.isScatterType(d) ?
|
|
@@ -135,7 +135,7 @@ export default {
|
|
|
135
135
|
.filter(Boolean)
|
|
136
136
|
.append($$.point("create", this, $$.pointR.bind($$), $$.color));
|
|
137
137
|
|
|
138
|
-
$root.circle = $root.main.selectAll(`.${
|
|
138
|
+
$root.circle = $root.main.selectAll(`.${$CIRCLE.circles} .${$CIRCLE.circle}`)
|
|
139
139
|
.style("stroke", $$.color)
|
|
140
140
|
.style("opacity", $$.initialOpacityForCircle.bind($$));
|
|
141
141
|
}
|
|
@@ -145,7 +145,7 @@ export default {
|
|
|
145
145
|
const $$ = this;
|
|
146
146
|
const {state: {rendered}, $el, $T} = $$;
|
|
147
147
|
const $root = isSub ? $el.subchart : $el;
|
|
148
|
-
const selectedCircles = $root.main.selectAll(`.${
|
|
148
|
+
const selectedCircles = $root.main.selectAll(`.${$SELECT.selectedCircle}`);
|
|
149
149
|
|
|
150
150
|
if (!$$.config.point_show) {
|
|
151
151
|
return [];
|
|
@@ -256,7 +256,7 @@ export default {
|
|
|
256
256
|
|
|
257
257
|
reset && $$.unexpandCircles();
|
|
258
258
|
|
|
259
|
-
const circles = $$.getShapeByIndex("circle", i, id).classed(
|
|
259
|
+
const circles = $$.getShapeByIndex("circle", i, id).classed($COMMON.EXPANDED, true);
|
|
260
260
|
const scale = r(circles) / $$.config.point_r;
|
|
261
261
|
const ratio = 1 - scale;
|
|
262
262
|
|
|
@@ -286,9 +286,9 @@ export default {
|
|
|
286
286
|
|
|
287
287
|
const circles = $$.getShapeByIndex("circle", i)
|
|
288
288
|
.filter(function() {
|
|
289
|
-
return d3Select(this).classed(
|
|
289
|
+
return d3Select(this).classed($COMMON.EXPANDED);
|
|
290
290
|
})
|
|
291
|
-
.classed(
|
|
291
|
+
.classed($COMMON.EXPANDED, false);
|
|
292
292
|
|
|
293
293
|
circles.attr("r", r);
|
|
294
294
|
|
|
@@ -398,8 +398,8 @@ export default {
|
|
|
398
398
|
circle.each(function(d) {
|
|
399
399
|
let className = $$.getClass("circle", true)(d);
|
|
400
400
|
|
|
401
|
-
if (this.getAttribute("class").indexOf(
|
|
402
|
-
className += ` ${
|
|
401
|
+
if (this.getAttribute("class").indexOf($COMMON.EXPANDED) > -1) {
|
|
402
|
+
className += ` ${$COMMON.EXPANDED}`;
|
|
403
403
|
}
|
|
404
404
|
|
|
405
405
|
this.setAttribute("class", className);
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import {select as d3Select} from "d3-selection";
|
|
6
6
|
import {KEY} from "../../module/Cache";
|
|
7
|
-
import
|
|
7
|
+
import {$AXIS, $COMMON, $RADAR, $SHAPE, $TEXT} from "../../config/classes";
|
|
8
8
|
import {getMinMax, getRange, isDefined, isEmpty, isNumber, isUndefined, setTextValue, toArray} from "../../module/util";
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -35,20 +35,20 @@ export default {
|
|
|
35
35
|
const {config, state: {current}, $el} = $$;
|
|
36
36
|
|
|
37
37
|
if ($$.hasType("radar")) {
|
|
38
|
-
$el.radar = $el.main.select(`.${
|
|
39
|
-
.attr("class",
|
|
38
|
+
$el.radar = $el.main.select(`.${$COMMON.chart}`).append("g")
|
|
39
|
+
.attr("class", $RADAR.chartRadars);
|
|
40
40
|
|
|
41
41
|
// level
|
|
42
42
|
$el.radar.levels = $el.radar.append("g")
|
|
43
|
-
.attr("class",
|
|
43
|
+
.attr("class", $RADAR.levels);
|
|
44
44
|
|
|
45
45
|
// axis
|
|
46
46
|
$el.radar.axes = $el.radar.append("g")
|
|
47
|
-
.attr("class",
|
|
47
|
+
.attr("class", $AXIS.axis);
|
|
48
48
|
|
|
49
49
|
// shapes
|
|
50
50
|
$el.radar.shapes = $el.radar.append("g")
|
|
51
|
-
.attr("class",
|
|
51
|
+
.attr("class", $SHAPE.shapes);
|
|
52
52
|
|
|
53
53
|
current.dataMax = config.radar_axis_max || $$.getMinMaxData().max[0].value;
|
|
54
54
|
}
|
|
@@ -126,7 +126,7 @@ export default {
|
|
|
126
126
|
// Adjust radar, circles and texts' position
|
|
127
127
|
if (translate) {
|
|
128
128
|
radar.attr("transform", translate);
|
|
129
|
-
main.select(`.${
|
|
129
|
+
main.select(`.${$TEXT.chartTexts}`).attr("transform", translate);
|
|
130
130
|
|
|
131
131
|
$$.generateRadarPoints();
|
|
132
132
|
$$.updateRadarLevel();
|
|
@@ -176,13 +176,13 @@ export default {
|
|
|
176
176
|
});
|
|
177
177
|
|
|
178
178
|
const level = radarLevels
|
|
179
|
-
.selectAll(`.${
|
|
179
|
+
.selectAll(`.${$RADAR.level}`)
|
|
180
180
|
.data(levelData);
|
|
181
181
|
|
|
182
182
|
level.exit().remove();
|
|
183
183
|
|
|
184
184
|
const levelEnter = level.enter().append("g")
|
|
185
|
-
.attr("class", (d, i) => `${
|
|
185
|
+
.attr("class", (d, i) => `${$RADAR.level} ${$RADAR.level}-${i}`);
|
|
186
186
|
|
|
187
187
|
levelEnter.append("polygon")
|
|
188
188
|
.style("visibility", config.radar_level_show ? null : "hidden");
|
|
@@ -231,7 +231,7 @@ export default {
|
|
|
231
231
|
axis.exit().remove();
|
|
232
232
|
|
|
233
233
|
const axisEnter = axis.enter().append("g")
|
|
234
|
-
.attr("class", (d, i) => `${
|
|
234
|
+
.attr("class", (d, i) => `${$AXIS.axis}-${i}`);
|
|
235
235
|
|
|
236
236
|
config.radar_axis_line_show && axisEnter.append("line");
|
|
237
237
|
config.radar_axis_text_show && axisEnter.append("text");
|
|
@@ -251,10 +251,12 @@ export default {
|
|
|
251
251
|
*/
|
|
252
252
|
getShapeYMin(id: string): number {
|
|
253
253
|
const $$ = this;
|
|
254
|
-
const
|
|
254
|
+
const axisId = $$.axis.getId(id);
|
|
255
|
+
const scale = $$.scale[axisId];
|
|
255
256
|
const [yMin] = scale.domain();
|
|
257
|
+
const inverted = $$.config[`axis_${axisId}_inverted`];
|
|
256
258
|
|
|
257
|
-
return !$$.isGrouped(id) && yMin > 0 ? yMin : 0;
|
|
259
|
+
return !$$.isGrouped(id) && !inverted && yMin > 0 ? yMin : 0;
|
|
258
260
|
},
|
|
259
261
|
|
|
260
262
|
/**
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) 2021 ~ present NAVER Corp.
|
|
3
3
|
* billboard.js project is licensed under the MIT license
|
|
4
4
|
*/
|
|
5
|
-
import
|
|
5
|
+
import {$COMMON} from "../../config/classes";
|
|
6
6
|
import Plugin from "../Plugin";
|
|
7
7
|
import Options from "./Options";
|
|
8
8
|
import {IData} from "../../ChartInternal/data/IData";
|
|
@@ -244,7 +244,7 @@ export default class Sparkline extends Plugin {
|
|
|
244
244
|
|
|
245
245
|
data.map(v => v.id)
|
|
246
246
|
.forEach((id, i) => {
|
|
247
|
-
const selector = `.${
|
|
247
|
+
const selector = `.${$COMMON.target}-${id}`;
|
|
248
248
|
const shape = $el.main.selectAll(selector);
|
|
249
249
|
let svg = el[i].querySelector("svg");
|
|
250
250
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import {interpolateHslLong as d3InterpolateHslLong} from "d3-interpolate";
|
|
7
7
|
import {hsl as d3Hsl} from "d3-color";
|
|
8
8
|
import {scaleSequentialLog as d3ScaleSequentialLog} from "d3-scale";
|
|
9
|
-
import
|
|
9
|
+
import {$TOOLTIP} from "../../config/classes";
|
|
10
10
|
import {loadConfig} from "../../config/config";
|
|
11
11
|
import Plugin from "../Plugin";
|
|
12
12
|
import Options from "./Options";
|
|
@@ -228,7 +228,7 @@ export default class Stanford extends Plugin {
|
|
|
228
228
|
|
|
229
229
|
if (isEmpty(config.tooltip_contents)) {
|
|
230
230
|
config.tooltip_contents = function(d, defaultTitleFormat, defaultValueFormat, color) {
|
|
231
|
-
let html = `<table class="${
|
|
231
|
+
let html = `<table class="${$TOOLTIP.tooltip}"><tbody>`;
|
|
232
232
|
|
|
233
233
|
d.forEach(v => {
|
|
234
234
|
html += `<tr>
|
|
@@ -239,7 +239,7 @@ export default class Stanford extends Plugin {
|
|
|
239
239
|
<th>${defaultTitleFormat(v.id)}</th>
|
|
240
240
|
<th class="value">${defaultValueFormat(v.value)}</th>
|
|
241
241
|
</tr>
|
|
242
|
-
<tr class="${
|
|
242
|
+
<tr class="${$TOOLTIP.tooltipName}-${v.id}">
|
|
243
243
|
<td class="name"><span style="background-color:${color(v)}"></span>${defaultTitleFormat("Epochs")}</td>
|
|
244
244
|
<td class="value">${defaultValueFormat(v.epochs)}</td>
|
|
245
245
|
</tr>`;
|
|
@@ -34,7 +34,16 @@ export default {
|
|
|
34
34
|
* - `element {SVGElement}`: Tooltip event bound element
|
|
35
35
|
* - `pos {object}`: Current position of the tooltip.
|
|
36
36
|
* @property {Function|object} [tooltip.contents] Set custom HTML for the tooltip.<br>
|
|
37
|
-
*
|
|
37
|
+
* If tooltip.grouped is true, data includes multiple data points.<br><br>
|
|
38
|
+
* Specified function receives `data` array and `defaultTitleFormat`, `defaultValueFormat` and `color` functions of the data point to show.
|
|
39
|
+
* - **Note:**
|
|
40
|
+
* - defaultTitleFormat:
|
|
41
|
+
* - if `axis.x.tick.format` option will be used if set.
|
|
42
|
+
* - otherwise, will return funciton based on tick format type(category, timeseries).
|
|
43
|
+
* - defaultValueFormat:
|
|
44
|
+
* - for Arc type (except gauge, radar), the function will return value from `(ratio * 100).toFixed(1)`.
|
|
45
|
+
* - for Axis based types, will be used `axis.[y|y2].tick.format` option value if is set.
|
|
46
|
+
* - otherwise, will parse value and return as number.
|
|
38
47
|
* @property {string|HTMLElement} [tooltip.contents.bindto=undefined] Set CSS selector or element reference to bind tooltip.
|
|
39
48
|
* - **NOTE:** When is specified, will not be updating tooltip's position.
|
|
40
49
|
* @property {string} [tooltip.contents.template=undefined] Set tooltip's template.<br><br>
|