billboard.js 3.3.0-next.1 → 3.3.2
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 +644 -427
- package/dist/billboard.min.css +1 -1
- package/dist/billboard.min.js +2 -2
- package/dist/billboard.pkgd.js +2809 -2331
- package/dist/billboard.pkgd.min.js +3 -3
- package/dist/plugin/billboardjs-plugin-bubblecompare.d.ts +7 -0
- 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.d.ts +7 -0
- package/dist/plugin/billboardjs-plugin-sparkline.js +156 -103
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-stanford.d.ts +7 -0
- package/dist/plugin/billboardjs-plugin-stanford.js +154 -101
- package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-tableview.d.ts +7 -0
- package/dist/plugin/billboardjs-plugin-tableview.js +20 -128
- package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-textoverlap.d.ts +7 -0
- package/dist/plugin/billboardjs-plugin-textoverlap.js +20 -128
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.js +2166 -1905
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.js +2325 -2011
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.js +2320 -2006
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.js +2186 -2033
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.js +2187 -2034
- 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 +642 -440
- package/dist-esm/plugin/billboardjs-plugin-bubblecompare.d.ts +7 -0
- package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -4
- package/dist-esm/plugin/billboardjs-plugin-sparkline.d.ts +7 -0
- package/dist-esm/plugin/billboardjs-plugin-sparkline.js +131 -79
- package/dist-esm/plugin/billboardjs-plugin-stanford.d.ts +7 -0
- package/dist-esm/plugin/billboardjs-plugin-stanford.js +135 -80
- package/dist-esm/plugin/billboardjs-plugin-tableview.d.ts +7 -0
- package/dist-esm/plugin/billboardjs-plugin-tableview.js +4 -8
- package/dist-esm/plugin/billboardjs-plugin-textoverlap.d.ts +7 -0
- package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +4 -7
- package/package.json +39 -38
- package/src/Chart/api/chart.ts +8 -2
- package/src/Chart/api/data.ts +3 -4
- 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 +26 -19
- package/src/ChartInternal/ChartInternal.ts +8 -7
- package/src/ChartInternal/data/IData.ts +9 -0
- package/src/ChartInternal/data/data.ts +4 -4
- 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 +46 -14
- 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 -6
- package/src/ChartInternal/internals/transform.ts +5 -5
- package/src/ChartInternal/shape/arc.ts +24 -22
- package/src/ChartInternal/shape/area.ts +4 -4
- package/src/ChartInternal/shape/bar.ts +11 -9
- 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 +12 -10
- package/src/ChartInternal/shape/shape.ts +43 -11
- package/src/Plugin/sparkline/index.ts +4 -4
- package/src/Plugin/stanford/index.ts +3 -3
- package/src/Plugin/stanford/util.ts +0 -1
- package/src/config/Options/axis/x.ts +25 -5
- package/src/config/Options/axis/y.ts +24 -3
- package/src/config/Options/axis/y2.ts +24 -3
- package/src/config/Options/common/tooltip.ts +10 -1
- package/src/config/Options/shape/bar.ts +8 -0
- package/src/config/classes.ts +154 -66
- package/src/module/util.ts +17 -11
- package/types/axis.d.ts +22 -8
- package/types/chart.d.ts +1 -1
- package/types/options.d.ts +32 -32
- package/types/plugin/tableview/index.d.ts +3 -3
- package/types/plugin/tableview/options.d.ts +1 -1
|
@@ -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}) => {
|
|
@@ -795,6 +795,8 @@ export default {
|
|
|
795
795
|
return;
|
|
796
796
|
}
|
|
797
797
|
|
|
798
|
+
state.event = event;
|
|
799
|
+
|
|
798
800
|
const eventArc = getEventArc(event);
|
|
799
801
|
const datum: any = eventArc.datum();
|
|
800
802
|
const updated = (datum?.data && datum.data.id) ? $$.updateAngle(datum) : null;
|
|
@@ -818,10 +820,10 @@ export default {
|
|
|
818
820
|
|
|
819
821
|
// for gauge type, update text when has no title & multi data
|
|
820
822
|
if (!(hasGauge && $$.data.targets.length === 1 && config.gauge_title)) {
|
|
821
|
-
text = main.selectAll(`.${
|
|
823
|
+
text = main.selectAll(`.${$ARC.chartArc}`)
|
|
822
824
|
.select("text")
|
|
823
825
|
.style("opacity", "0")
|
|
824
|
-
.attr("class", d => ($$.isGaugeType(d.data) ?
|
|
826
|
+
.attr("class", d => ($$.isGaugeType(d.data) ? $GAUGE.gaugeValue : null))
|
|
825
827
|
.call($$.textForArcLabel.bind($$))
|
|
826
828
|
.attr("transform", $$.transformForArcLabel.bind($$))
|
|
827
829
|
.style("font-size", d => (
|
|
@@ -835,7 +837,7 @@ export default {
|
|
|
835
837
|
hasMultiArcGauge && text.attr("dy", "-.1em");
|
|
836
838
|
}
|
|
837
839
|
|
|
838
|
-
main.select(`.${
|
|
840
|
+
main.select(`.${$ARC.chartArcsTitle}`)
|
|
839
841
|
.style("opacity", $$.hasType("donut") || hasGauge ? null : "0");
|
|
840
842
|
|
|
841
843
|
if (hasGauge) {
|
|
@@ -844,17 +846,17 @@ export default {
|
|
|
844
846
|
isFullCircle && text?.attr("dy", `${hasMultiArcGauge ? 0 : Math.round(state.radius / 14)}`);
|
|
845
847
|
|
|
846
848
|
if (config.gauge_label_show) {
|
|
847
|
-
arcs.select(`.${
|
|
849
|
+
arcs.select(`.${$GAUGE.chartArcsGaugeUnit}`)
|
|
848
850
|
.attr("dy", `${isFullCircle ? 1.5 : 0.75}em`)
|
|
849
851
|
.text(config.gauge_units);
|
|
850
852
|
|
|
851
|
-
arcs.select(`.${
|
|
853
|
+
arcs.select(`.${$GAUGE.chartArcsGaugeMin}`)
|
|
852
854
|
.attr("dx", `${-1 * (state.innerRadius + ((state.radius - state.innerRadius) / (isFullCircle ? 1 : 2)))}px`)
|
|
853
855
|
.attr("dy", "1.2em")
|
|
854
856
|
.text($$.textForGaugeMinMax(config.gauge_min, false));
|
|
855
857
|
|
|
856
858
|
// show max text when isn't fullCircle
|
|
857
|
-
!isFullCircle && arcs.select(`.${
|
|
859
|
+
!isFullCircle && arcs.select(`.${$GAUGE.chartArcsGaugeMax}`)
|
|
858
860
|
.attr("dx", `${state.innerRadius + ((state.radius - state.innerRadius) / 2)}px`)
|
|
859
861
|
.attr("dy", "1.2em")
|
|
860
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)
|
|
@@ -153,9 +153,11 @@ export default {
|
|
|
153
153
|
const pathRadius = ["", ""];
|
|
154
154
|
let radius = 0;
|
|
155
155
|
|
|
156
|
-
const
|
|
156
|
+
const isGrouped = $$.isGrouped(d.id);
|
|
157
|
+
const hasRadius = d.value !== 0 && getRadius;
|
|
158
|
+
const isRadiusData = hasRadius && isGrouped ? $$.isStackingRadiusData(d) : false;
|
|
157
159
|
|
|
158
|
-
if (
|
|
160
|
+
if (hasRadius && (!isGrouped || isRadiusData)) {
|
|
159
161
|
const index = isRotated ? indexY : indexX;
|
|
160
162
|
const barW = points[2][index] - points[0][index];
|
|
161
163
|
|
|
@@ -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");
|
|
@@ -314,6 +314,8 @@ export default {
|
|
|
314
314
|
return d && Object.keys(d).length === 1 ? d.index : undefined;
|
|
315
315
|
};
|
|
316
316
|
const hide = event => {
|
|
317
|
+
state.event = event;
|
|
318
|
+
|
|
317
319
|
const index = getIndex(event);
|
|
318
320
|
const noIndex = isUndefined(index);
|
|
319
321
|
|