@evergis/charts 3.1.53-alpha.1 → 3.1.53
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/LICENSE +21 -21
- package/README.md +25 -25
- package/dist/charts/BarChart/types.d.ts +1 -0
- package/dist/charts/LineChart/types.d.ts +1 -0
- package/dist/charts/PieChart/types.d.ts +1 -0
- package/dist/charts.esm.js +520 -415
- package/dist/charts.esm.js.map +1 -1
- package/dist/index.js +520 -415
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -27,10 +27,10 @@ function _interopNamespaceDefault(e) {
|
|
|
27
27
|
|
|
28
28
|
var d3__namespace = /*#__PURE__*/_interopNamespaceDefault(d3);
|
|
29
29
|
|
|
30
|
-
const Wrapper = styled.div `
|
|
31
|
-
position: relative;
|
|
32
|
-
width: 100%;
|
|
33
|
-
box-sizing: border-box;
|
|
30
|
+
const Wrapper = styled.div `
|
|
31
|
+
position: relative;
|
|
32
|
+
width: 100%;
|
|
33
|
+
box-sizing: border-box;
|
|
34
34
|
`;
|
|
35
35
|
|
|
36
36
|
function useNode() {
|
|
@@ -128,10 +128,10 @@ const drawMarkers = ({ svg, markers, width, left, top, count, yScale }) => {
|
|
|
128
128
|
});
|
|
129
129
|
};
|
|
130
130
|
|
|
131
|
-
const SwipeScrollContainer = styled.div `
|
|
132
|
-
width: 100%;
|
|
133
|
-
overflow: hidden;
|
|
134
|
-
user-select: none;
|
|
131
|
+
const SwipeScrollContainer = styled.div `
|
|
132
|
+
width: 100%;
|
|
133
|
+
overflow: hidden;
|
|
134
|
+
user-select: none;
|
|
135
135
|
`;
|
|
136
136
|
|
|
137
137
|
function animate({ duration, timing, draw, }) {
|
|
@@ -283,37 +283,37 @@ const getTranslate$1 = ({ anchor, index, translateX, translateY, }) => {
|
|
|
283
283
|
}
|
|
284
284
|
return `translate(${translateX}px, ${translateY}px)`;
|
|
285
285
|
};
|
|
286
|
-
const Label$2 = styled.div `
|
|
287
|
-
display: flex;
|
|
288
|
-
align-items: center;
|
|
289
|
-
font-size: 12px;
|
|
286
|
+
const Label$2 = styled.div `
|
|
287
|
+
display: flex;
|
|
288
|
+
align-items: center;
|
|
289
|
+
font-size: 12px;
|
|
290
290
|
`;
|
|
291
|
-
const Name$1 = styled.div `
|
|
292
|
-
text-align: center;
|
|
293
|
-
max-width: 120px;
|
|
291
|
+
const Name$1 = styled.div `
|
|
292
|
+
text-align: center;
|
|
293
|
+
max-width: 120px;
|
|
294
294
|
`;
|
|
295
|
-
const middleBadgeStyles = styled.css `
|
|
296
|
-
position: absolute;
|
|
297
|
-
top: 50%;
|
|
298
|
-
right: 0;
|
|
299
|
-
transform: translate(calc(100% + 6px), -50%);
|
|
295
|
+
const middleBadgeStyles = styled.css `
|
|
296
|
+
position: absolute;
|
|
297
|
+
top: 50%;
|
|
298
|
+
right: 0;
|
|
299
|
+
transform: translate(calc(100% + 6px), -50%);
|
|
300
300
|
`;
|
|
301
|
-
const DefaultBadge = styled.div `
|
|
302
|
-
display: flex;
|
|
303
|
-
align-items: center;
|
|
304
|
-
padding: 2px 4px;
|
|
305
|
-
border-radius: 4px;
|
|
306
|
-
color: rgb(255, 255, 255);
|
|
307
|
-
background-color: rgb(144, 197, 61);
|
|
308
|
-
margin-left: 8px;
|
|
301
|
+
const DefaultBadge = styled.div `
|
|
302
|
+
display: flex;
|
|
303
|
+
align-items: center;
|
|
304
|
+
padding: 2px 4px;
|
|
305
|
+
border-radius: 4px;
|
|
306
|
+
color: rgb(255, 255, 255);
|
|
307
|
+
background-color: rgb(144, 197, 61);
|
|
308
|
+
margin-left: 8px;
|
|
309
309
|
`;
|
|
310
|
-
const MiddleBadge = styled(DefaultBadge) `
|
|
311
|
-
${middleBadgeStyles}
|
|
310
|
+
const MiddleBadge = styled(DefaultBadge) `
|
|
311
|
+
${middleBadgeStyles}
|
|
312
312
|
`;
|
|
313
|
-
const BadgePrefix = styled.div `
|
|
314
|
-
margin-left: 4px;
|
|
315
|
-
font-size: 10px;
|
|
316
|
-
color: rgba(255, 255, 255, 0.54);
|
|
313
|
+
const BadgePrefix = styled.div `
|
|
314
|
+
margin-left: 4px;
|
|
315
|
+
font-size: 10px;
|
|
316
|
+
color: rgba(255, 255, 255, 0.54);
|
|
317
317
|
`;
|
|
318
318
|
|
|
319
319
|
const radarChartclassNames = {
|
|
@@ -328,29 +328,29 @@ const radarChartclassNames = {
|
|
|
328
328
|
radarLabelBadgePrefix: 'radarLabelBadgePrefix',
|
|
329
329
|
radarCircle: 'radarCircle',
|
|
330
330
|
};
|
|
331
|
-
const SvgWrapper$5 = styled(Wrapper) `
|
|
332
|
-
.${radarChartclassNames.radarAxis} {
|
|
333
|
-
path,
|
|
334
|
-
line,
|
|
335
|
-
circle {
|
|
336
|
-
fill: none;
|
|
337
|
-
stroke-width: 1px;
|
|
338
|
-
stroke: rgba(149, 149, 149, 0.18);
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
.${radarChartclassNames.radarAxisText} {
|
|
342
|
-
font-size: 12px;
|
|
343
|
-
fill-opacity: 0.56;
|
|
344
|
-
}
|
|
345
|
-
.${radarChartclassNames.radarPolygon} {
|
|
346
|
-
fill-opacity: 0.06;
|
|
347
|
-
stroke-width: 2px;
|
|
348
|
-
fill: rgb(144, 197, 61);
|
|
349
|
-
stroke: rgb(144, 197, 61);
|
|
350
|
-
}
|
|
351
|
-
.${radarChartclassNames.radarCircle} {
|
|
352
|
-
fill: rgb(144, 197, 61);
|
|
353
|
-
}
|
|
331
|
+
const SvgWrapper$5 = styled(Wrapper) `
|
|
332
|
+
.${radarChartclassNames.radarAxis} {
|
|
333
|
+
path,
|
|
334
|
+
line,
|
|
335
|
+
circle {
|
|
336
|
+
fill: none;
|
|
337
|
+
stroke-width: 1px;
|
|
338
|
+
stroke: rgba(149, 149, 149, 0.18);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
.${radarChartclassNames.radarAxisText} {
|
|
342
|
+
font-size: 12px;
|
|
343
|
+
fill-opacity: 0.56;
|
|
344
|
+
}
|
|
345
|
+
.${radarChartclassNames.radarPolygon} {
|
|
346
|
+
fill-opacity: 0.06;
|
|
347
|
+
stroke-width: 2px;
|
|
348
|
+
fill: rgb(144, 197, 61);
|
|
349
|
+
stroke: rgb(144, 197, 61);
|
|
350
|
+
}
|
|
351
|
+
.${radarChartclassNames.radarCircle} {
|
|
352
|
+
fill: rgb(144, 197, 61);
|
|
353
|
+
}
|
|
354
354
|
`;
|
|
355
355
|
|
|
356
356
|
const getTranslate = ({ anchor, index, translateX, translateY, }) => {
|
|
@@ -372,8 +372,8 @@ const LabelContainer$1 = styled.div.attrs(props => ({
|
|
|
372
372
|
style: {
|
|
373
373
|
transform: getTranslate(props),
|
|
374
374
|
},
|
|
375
|
-
})) `
|
|
376
|
-
position: absolute;
|
|
375
|
+
})) `
|
|
376
|
+
position: absolute;
|
|
377
377
|
`;
|
|
378
378
|
|
|
379
379
|
const degByIndex = (index, count) => {
|
|
@@ -637,24 +637,24 @@ const pieChartclassNames = {
|
|
|
637
637
|
pieTooltipColorBox: 'pieTooltipColorBox',
|
|
638
638
|
pieFullChartTooltipCircle: 'pieFullChartTooltipCircle',
|
|
639
639
|
};
|
|
640
|
-
const SvgWrapper$4 = styled(Wrapper) `
|
|
641
|
-
.${pieChartclassNames.pieSliceLabel} {
|
|
642
|
-
fill: #4a4a4a;
|
|
643
|
-
}
|
|
644
|
-
|
|
645
|
-
.${pieChartclassNames.pieRadialLabel} {
|
|
646
|
-
position: absolute;
|
|
647
|
-
max-width: 128px;
|
|
648
|
-
}
|
|
649
|
-
|
|
650
|
-
.${pieChartclassNames.pieRadialLink} {
|
|
651
|
-
stroke: #000;
|
|
652
|
-
}
|
|
653
|
-
|
|
654
|
-
.${pieChartclassNames.pieFullChartTooltipCircle} {
|
|
655
|
-
fill: transparent;
|
|
656
|
-
cursor: pointer;
|
|
657
|
-
}
|
|
640
|
+
const SvgWrapper$4 = styled(Wrapper) `
|
|
641
|
+
.${pieChartclassNames.pieSliceLabel} {
|
|
642
|
+
fill: #4a4a4a;
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
.${pieChartclassNames.pieRadialLabel} {
|
|
646
|
+
position: absolute;
|
|
647
|
+
max-width: 128px;
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
.${pieChartclassNames.pieRadialLink} {
|
|
651
|
+
stroke: #000;
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
.${pieChartclassNames.pieFullChartTooltipCircle} {
|
|
655
|
+
fill: transparent;
|
|
656
|
+
cursor: pointer;
|
|
657
|
+
}
|
|
658
658
|
`;
|
|
659
659
|
|
|
660
660
|
function radiansToDegrees(radians) {
|
|
@@ -754,90 +754,90 @@ const drawRadialLabels = ({ arc, enableRadialLabels, global, node, radius, dataR
|
|
|
754
754
|
}
|
|
755
755
|
};
|
|
756
756
|
|
|
757
|
-
const TooltipFlex$1 = styled.div `
|
|
758
|
-
width: 0;
|
|
759
|
-
height: 0;
|
|
760
|
-
display: flex;
|
|
761
|
-
align-items: flex-end;
|
|
762
|
-
justify-content: center;
|
|
763
|
-
pointer-events: none;
|
|
764
|
-
white-space: nowrap;
|
|
757
|
+
const TooltipFlex$1 = styled.div `
|
|
758
|
+
width: 0;
|
|
759
|
+
height: 0;
|
|
760
|
+
display: flex;
|
|
761
|
+
align-items: flex-end;
|
|
762
|
+
justify-content: center;
|
|
763
|
+
pointer-events: none;
|
|
764
|
+
white-space: nowrap;
|
|
765
765
|
`;
|
|
766
766
|
const LabelFlex = styled(TooltipFlex$1) ``;
|
|
767
|
-
const LabelFlexCenter = styled(LabelFlex) `
|
|
768
|
-
align-items: center;
|
|
767
|
+
const LabelFlexCenter = styled(LabelFlex) `
|
|
768
|
+
align-items: center;
|
|
769
769
|
`;
|
|
770
|
-
const TooltipContainer = styled.div `
|
|
771
|
-
position: relative;
|
|
772
|
-
font-size: 11px;
|
|
773
|
-
color: #fff;
|
|
774
|
-
margin-bottom: 8px;
|
|
775
|
-
padding: 4px 6px;
|
|
776
|
-
background-color: rgba(48, 69, 79, 1);
|
|
777
|
-
border-radius: 4px;
|
|
778
|
-
box-shadow: 0 0.1875rem 0.5rem rgba(48, 69, 79, 0.06);
|
|
779
|
-
|
|
780
|
-
:before {
|
|
781
|
-
content: '';
|
|
782
|
-
position: absolute;
|
|
783
|
-
bottom: 0;
|
|
784
|
-
left: 50%;
|
|
785
|
-
transform: translate(-50%, 100%);
|
|
786
|
-
width: 0;
|
|
787
|
-
height: 0;
|
|
788
|
-
border-style: solid;
|
|
789
|
-
border-width: 4px 3px 0 3px;
|
|
790
|
-
border-color: rgba(48, 69, 79, 1) transparent transparent transparent;
|
|
791
|
-
}
|
|
770
|
+
const TooltipContainer = styled.div `
|
|
771
|
+
position: relative;
|
|
772
|
+
font-size: 11px;
|
|
773
|
+
color: #fff;
|
|
774
|
+
margin-bottom: 8px;
|
|
775
|
+
padding: 4px 6px;
|
|
776
|
+
background-color: rgba(48, 69, 79, 1);
|
|
777
|
+
border-radius: 4px;
|
|
778
|
+
box-shadow: 0 0.1875rem 0.5rem rgba(48, 69, 79, 0.06);
|
|
779
|
+
|
|
780
|
+
:before {
|
|
781
|
+
content: '';
|
|
782
|
+
position: absolute;
|
|
783
|
+
bottom: 0;
|
|
784
|
+
left: 50%;
|
|
785
|
+
transform: translate(-50%, 100%);
|
|
786
|
+
width: 0;
|
|
787
|
+
height: 0;
|
|
788
|
+
border-style: solid;
|
|
789
|
+
border-width: 4px 3px 0 3px;
|
|
790
|
+
border-color: rgba(48, 69, 79, 1) transparent transparent transparent;
|
|
791
|
+
}
|
|
792
792
|
`;
|
|
793
|
-
const TooltipGroupName = styled.div `
|
|
794
|
-
font-size: 14px;
|
|
795
|
-
margin-bottom: 6px;
|
|
793
|
+
const TooltipGroupName = styled.div `
|
|
794
|
+
font-size: 14px;
|
|
795
|
+
margin-bottom: 6px;
|
|
796
796
|
`;
|
|
797
|
-
const TooltipItem = styled.div `
|
|
798
|
-
display: flex;
|
|
799
|
-
align-items: center;
|
|
800
|
-
margin-bottom: 0.25rem;
|
|
801
|
-
|
|
802
|
-
&:last-of-type {
|
|
803
|
-
margin-bottom: 0;
|
|
804
|
-
}
|
|
797
|
+
const TooltipItem = styled.div `
|
|
798
|
+
display: flex;
|
|
799
|
+
align-items: center;
|
|
800
|
+
margin-bottom: 0.25rem;
|
|
801
|
+
|
|
802
|
+
&:last-of-type {
|
|
803
|
+
margin-bottom: 0;
|
|
804
|
+
}
|
|
805
805
|
`;
|
|
806
|
-
const ColFlex = styled.div `
|
|
807
|
-
display: flex;
|
|
808
|
-
align-items: center;
|
|
809
|
-
margin-right: 4px;
|
|
806
|
+
const ColFlex = styled.div `
|
|
807
|
+
display: flex;
|
|
808
|
+
align-items: center;
|
|
809
|
+
margin-right: 4px;
|
|
810
810
|
`;
|
|
811
|
-
const ColorBox = styled.div `
|
|
812
|
-
margin-right: 4px;
|
|
813
|
-
width: 10px;
|
|
814
|
-
height: 10px;
|
|
815
|
-
border-radius: 2px;
|
|
811
|
+
const ColorBox = styled.div `
|
|
812
|
+
margin-right: 4px;
|
|
813
|
+
width: 10px;
|
|
814
|
+
height: 10px;
|
|
815
|
+
border-radius: 2px;
|
|
816
816
|
`;
|
|
817
|
-
const ColorLine = styled(ColorBox) `
|
|
818
|
-
height: 2px;
|
|
819
|
-
border-radius: 0;
|
|
817
|
+
const ColorLine = styled(ColorBox) `
|
|
818
|
+
height: 2px;
|
|
819
|
+
border-radius: 0;
|
|
820
820
|
`;
|
|
821
|
-
const Name = styled.div `
|
|
822
|
-
margin-right: 4px;
|
|
821
|
+
const Name = styled.div `
|
|
822
|
+
margin-right: 4px;
|
|
823
823
|
`;
|
|
824
|
-
const Value = styled.div `
|
|
825
|
-
text-align: right;
|
|
826
|
-
flex-shrink: 0;
|
|
827
|
-
flex-grow: 1;
|
|
824
|
+
const Value = styled.div `
|
|
825
|
+
text-align: right;
|
|
826
|
+
flex-shrink: 0;
|
|
827
|
+
flex-grow: 1;
|
|
828
828
|
`;
|
|
829
|
-
const Label$1 = styled.div `
|
|
830
|
-
position: relative;
|
|
831
|
-
font-size: 11px;
|
|
832
|
-
color: #fff;
|
|
833
|
-
font-weight: bold;
|
|
834
|
-
letter-spacing: 0.52px;
|
|
829
|
+
const Label$1 = styled.div `
|
|
830
|
+
position: relative;
|
|
831
|
+
font-size: 11px;
|
|
832
|
+
color: #fff;
|
|
833
|
+
font-weight: bold;
|
|
834
|
+
letter-spacing: 0.52px;
|
|
835
835
|
`;
|
|
836
|
-
const LabelTop = styled(Label$1) `
|
|
837
|
-
top: 6px;
|
|
836
|
+
const LabelTop = styled(Label$1) `
|
|
837
|
+
top: 6px;
|
|
838
838
|
`;
|
|
839
|
-
const LabelBottom = styled(Label$1) `
|
|
840
|
-
bottom: 6px;
|
|
839
|
+
const LabelBottom = styled(Label$1) `
|
|
840
|
+
bottom: 6px;
|
|
841
841
|
`;
|
|
842
842
|
|
|
843
843
|
const drawTooltip$3 = ({ fullChartTooltip, global, tooltipRoot, data, tooltipClassName, tooltipBind, renderTooltip, arc, allSlices, tooltipStyle, width, height, radius, }) => {
|
|
@@ -921,8 +921,15 @@ const drawTooltip$3 = ({ fullChartTooltip, global, tooltipRoot, data, tooltipCla
|
|
|
921
921
|
}
|
|
922
922
|
};
|
|
923
923
|
|
|
924
|
+
const getSliceKey = (item, index) => {
|
|
925
|
+
if (item.id !== undefined)
|
|
926
|
+
return String(item.id);
|
|
927
|
+
if (typeof item.name === 'string' || typeof item.name === 'number')
|
|
928
|
+
return String(item.name);
|
|
929
|
+
return String(index);
|
|
930
|
+
};
|
|
924
931
|
const draw$4 = (node, props) => {
|
|
925
|
-
const { data, padAngle, onClick, outerRadius, startAngle, endAngle, cornerRadius, margin, enableSlicesLabels, formatSliceLabel, slicesLabelsSkipAngle, enableSlicesLabelsName, formatSliceLabelName, borderWidth, borderColor, enableRadialLabels, backgroundColor, radialLabelsLinkHorizontalLength, radialLabelsTextXOffset, formatRadialLabel, radialLabelYOffset, svgElements, formatSliceTitle, radialAngleXOffset, withTooltip, fullChartTooltip, tooltipClassName, tooltipBind, renderTooltip, tooltipStyle, } = props;
|
|
932
|
+
const { data, padAngle, onClick, outerRadius, startAngle, endAngle, cornerRadius, margin, enableSlicesLabels, formatSliceLabel, slicesLabelsSkipAngle, enableSlicesLabelsName, formatSliceLabelName, borderWidth, borderColor, enableRadialLabels, backgroundColor, radialLabelsLinkHorizontalLength, radialLabelsTextXOffset, formatRadialLabel, radialLabelYOffset, svgElements, formatSliceTitle, radialAngleXOffset, withTooltip, fullChartTooltip, tooltipClassName, tooltipBind, renderTooltip, tooltipStyle, transitionDuration = 300, } = props;
|
|
926
933
|
if (node !== null && data.length) {
|
|
927
934
|
const marginTop = margin ? margin.top : 0;
|
|
928
935
|
const marginRight = margin ? margin.right : 0;
|
|
@@ -938,6 +945,18 @@ const draw$4 = (node, props) => {
|
|
|
938
945
|
? marginTop + marginBottom
|
|
939
946
|
: marginRight + marginLeft)) /
|
|
940
947
|
2;
|
|
948
|
+
const prevArcMap = new Map();
|
|
949
|
+
if (transitionDuration > 0) {
|
|
950
|
+
d3__namespace.select(node)
|
|
951
|
+
.selectAll(`svg .${pieChartclassNames.pieGlobal} .${pieChartclassNames.pieSlice}`)
|
|
952
|
+
.each((d) => {
|
|
953
|
+
prevArcMap.set(getSliceKey(d.data, d.index), {
|
|
954
|
+
startAngle: d.startAngle,
|
|
955
|
+
endAngle: d.endAngle,
|
|
956
|
+
color: d.data.color ?? '',
|
|
957
|
+
});
|
|
958
|
+
});
|
|
959
|
+
}
|
|
941
960
|
const svg = appendSvg(node, width, height);
|
|
942
961
|
const global = svg
|
|
943
962
|
.append("g")
|
|
@@ -982,17 +1001,14 @@ const draw$4 = (node, props) => {
|
|
|
982
1001
|
.data(dataReady)
|
|
983
1002
|
.enter()
|
|
984
1003
|
.append("path")
|
|
985
|
-
// @ts-ignore
|
|
986
|
-
.attr("d", arc);
|
|
987
|
-
allSlices
|
|
988
1004
|
.attr("class", pieChartclassNames.pieSlice)
|
|
989
|
-
.attr("fill", ({ index }) => data[index].color || "")
|
|
990
1005
|
.attr("stroke", borderColor || "")
|
|
991
1006
|
.attr("stroke-width", borderWidth || 0)
|
|
992
1007
|
.attr("style", onClick ? "cursor: pointer" : "")
|
|
993
1008
|
.on("click",
|
|
994
1009
|
// @ts-ignore
|
|
995
|
-
(_, d) => onClick && onClick(data[d.index]))
|
|
1010
|
+
(_, d) => onClick && onClick(data[d.index]));
|
|
1011
|
+
allSlices
|
|
996
1012
|
.append("svg:title")
|
|
997
1013
|
.text(d => formatSliceTitle
|
|
998
1014
|
? // @ts-ignore
|
|
@@ -1000,6 +1016,46 @@ const draw$4 = (node, props) => {
|
|
|
1000
1016
|
: fullChartTooltip || withTooltip
|
|
1001
1017
|
? ""
|
|
1002
1018
|
: `${data[d.index].name || ""} (${format(data[d.index].value)})`);
|
|
1019
|
+
if (transitionDuration > 0 && prevArcMap.size > 0) {
|
|
1020
|
+
allSlices
|
|
1021
|
+
.attr("fill", (d) => {
|
|
1022
|
+
const prev = prevArcMap.get(getSliceKey(d.data, d.index));
|
|
1023
|
+
return prev?.color || data[d.index].color || "";
|
|
1024
|
+
})
|
|
1025
|
+
.attr("d", (d) => {
|
|
1026
|
+
const prev = prevArcMap.get(getSliceKey(d.data, d.index));
|
|
1027
|
+
const midAngle = (d.startAngle + d.endAngle) / 2;
|
|
1028
|
+
// @ts-ignore
|
|
1029
|
+
return arc({
|
|
1030
|
+
...d,
|
|
1031
|
+
startAngle: prev ? prev.startAngle : midAngle,
|
|
1032
|
+
endAngle: prev ? prev.endAngle : midAngle,
|
|
1033
|
+
});
|
|
1034
|
+
})
|
|
1035
|
+
.transition()
|
|
1036
|
+
.duration(transitionDuration)
|
|
1037
|
+
.attr("fill", ({ index }) => data[index].color || "")
|
|
1038
|
+
.attrTween("d", (d) => {
|
|
1039
|
+
const prev = prevArcMap.get(getSliceKey(d.data, d.index));
|
|
1040
|
+
const midAngle = (d.startAngle + d.endAngle) / 2;
|
|
1041
|
+
const from = {
|
|
1042
|
+
startAngle: prev ? prev.startAngle : midAngle,
|
|
1043
|
+
endAngle: prev ? prev.endAngle : midAngle,
|
|
1044
|
+
};
|
|
1045
|
+
const interp = d3__namespace.interpolate(from, { startAngle: d.startAngle, endAngle: d.endAngle });
|
|
1046
|
+
return (t) => {
|
|
1047
|
+
const { startAngle, endAngle } = interp(t);
|
|
1048
|
+
// @ts-ignore
|
|
1049
|
+
return arc({ ...d, startAngle, endAngle });
|
|
1050
|
+
};
|
|
1051
|
+
});
|
|
1052
|
+
}
|
|
1053
|
+
else {
|
|
1054
|
+
allSlices
|
|
1055
|
+
// @ts-ignore
|
|
1056
|
+
.attr("d", arc)
|
|
1057
|
+
.attr("fill", ({ index }) => data[index].color || "");
|
|
1058
|
+
}
|
|
1003
1059
|
if (enableSlicesLabels) {
|
|
1004
1060
|
const text = global
|
|
1005
1061
|
.selectAll("allSlices")
|
|
@@ -1226,53 +1282,53 @@ const calendarChartClassNames = {
|
|
|
1226
1282
|
...legendClassNames,
|
|
1227
1283
|
};
|
|
1228
1284
|
const headerHeight = "20px";
|
|
1229
|
-
const SvgWrapper$3 = styled(Wrapper) `
|
|
1230
|
-
.${calendarChartClassNames.calendarYear} {
|
|
1231
|
-
display: flex;
|
|
1232
|
-
margin-bottom: 16px;
|
|
1233
|
-
}
|
|
1234
|
-
|
|
1235
|
-
.${calendarChartClassNames.calendarYearTitle} {
|
|
1236
|
-
display: inline-flex;
|
|
1237
|
-
align-items: flex-end;
|
|
1238
|
-
height: ${headerHeight};
|
|
1239
|
-
margin-bottom: 4px;
|
|
1240
|
-
font-weight: bold;
|
|
1241
|
-
}
|
|
1242
|
-
|
|
1243
|
-
.${calendarChartClassNames.calendarHeader} {
|
|
1244
|
-
height: ${headerHeight};
|
|
1245
|
-
margin-bottom: 4px;
|
|
1246
|
-
position: relative;
|
|
1247
|
-
display: flex;
|
|
1248
|
-
}
|
|
1249
|
-
|
|
1250
|
-
.${calendarChartClassNames.calendarMonth} {
|
|
1251
|
-
font-size: 14px;
|
|
1252
|
-
bottom: 0;
|
|
1253
|
-
position: absolute;
|
|
1254
|
-
}
|
|
1255
|
-
|
|
1256
|
-
.${calendarChartClassNames.calendarAxis} {
|
|
1257
|
-
display: flex;
|
|
1258
|
-
flex-direction: column;
|
|
1259
|
-
margin-right: 10px;
|
|
1260
|
-
}
|
|
1261
|
-
|
|
1262
|
-
.${calendarChartClassNames.calendarWeekDay} {
|
|
1263
|
-
font-size: 12px;
|
|
1264
|
-
display: inline-flex;
|
|
1265
|
-
align-items: center;
|
|
1266
|
-
justify-content: flex-end;
|
|
1267
|
-
}
|
|
1268
|
-
|
|
1269
|
-
.${calendarChartClassNames.calendarDays} {
|
|
1270
|
-
position: relative;
|
|
1271
|
-
}
|
|
1272
|
-
|
|
1273
|
-
.${calendarChartClassNames.calendarDay} {
|
|
1274
|
-
position: absolute;
|
|
1275
|
-
}
|
|
1285
|
+
const SvgWrapper$3 = styled(Wrapper) `
|
|
1286
|
+
.${calendarChartClassNames.calendarYear} {
|
|
1287
|
+
display: flex;
|
|
1288
|
+
margin-bottom: 16px;
|
|
1289
|
+
}
|
|
1290
|
+
|
|
1291
|
+
.${calendarChartClassNames.calendarYearTitle} {
|
|
1292
|
+
display: inline-flex;
|
|
1293
|
+
align-items: flex-end;
|
|
1294
|
+
height: ${headerHeight};
|
|
1295
|
+
margin-bottom: 4px;
|
|
1296
|
+
font-weight: bold;
|
|
1297
|
+
}
|
|
1298
|
+
|
|
1299
|
+
.${calendarChartClassNames.calendarHeader} {
|
|
1300
|
+
height: ${headerHeight};
|
|
1301
|
+
margin-bottom: 4px;
|
|
1302
|
+
position: relative;
|
|
1303
|
+
display: flex;
|
|
1304
|
+
}
|
|
1305
|
+
|
|
1306
|
+
.${calendarChartClassNames.calendarMonth} {
|
|
1307
|
+
font-size: 14px;
|
|
1308
|
+
bottom: 0;
|
|
1309
|
+
position: absolute;
|
|
1310
|
+
}
|
|
1311
|
+
|
|
1312
|
+
.${calendarChartClassNames.calendarAxis} {
|
|
1313
|
+
display: flex;
|
|
1314
|
+
flex-direction: column;
|
|
1315
|
+
margin-right: 10px;
|
|
1316
|
+
}
|
|
1317
|
+
|
|
1318
|
+
.${calendarChartClassNames.calendarWeekDay} {
|
|
1319
|
+
font-size: 12px;
|
|
1320
|
+
display: inline-flex;
|
|
1321
|
+
align-items: center;
|
|
1322
|
+
justify-content: flex-end;
|
|
1323
|
+
}
|
|
1324
|
+
|
|
1325
|
+
.${calendarChartClassNames.calendarDays} {
|
|
1326
|
+
position: relative;
|
|
1327
|
+
}
|
|
1328
|
+
|
|
1329
|
+
.${calendarChartClassNames.calendarDay} {
|
|
1330
|
+
position: absolute;
|
|
1331
|
+
}
|
|
1276
1332
|
`;
|
|
1277
1333
|
|
|
1278
1334
|
const draw$3 = (node, props) => {
|
|
@@ -1499,67 +1555,67 @@ const lineChartClassNames = {
|
|
|
1499
1555
|
lineChartMouseLabelContainer: "lineChartMouseLabelContainer",
|
|
1500
1556
|
lineChartMouseLabel: "lineChartMouseLabel",
|
|
1501
1557
|
};
|
|
1502
|
-
const SvgWrapper$2 = styled(Wrapper) `
|
|
1503
|
-
.${lineChartClassNames.lineChartYScaleGlobal},
|
|
1504
|
-
.${lineChartClassNames.lineChartXScaleGlobal},
|
|
1505
|
-
.${lineChartClassNames.lineChartGridGlobal} {
|
|
1506
|
-
shape-rendering: crispEdges;
|
|
1507
|
-
}
|
|
1508
|
-
|
|
1509
|
-
.${lineChartClassNames.lineChartLinesGlobal} {
|
|
1510
|
-
fill: none;
|
|
1511
|
-
stroke: steelblue;
|
|
1512
|
-
stroke-width: 1.5px;
|
|
1513
|
-
stroke-linejoin: round;
|
|
1514
|
-
stroke-linecap: round;
|
|
1515
|
-
}
|
|
1516
|
-
|
|
1517
|
-
.${lineChartClassNames.lineChartArea} {
|
|
1518
|
-
fill-opacity: 0.24;
|
|
1519
|
-
}
|
|
1520
|
-
|
|
1521
|
-
.${lineChartClassNames.lineChartGridLineX},
|
|
1522
|
-
.${lineChartClassNames.lineChartGridLineY},
|
|
1523
|
-
.${lineChartClassNames.lineChartMouseLine} {
|
|
1524
|
-
stroke: rgba(149, 149, 149, 0.24);
|
|
1525
|
-
}
|
|
1526
|
-
|
|
1527
|
-
.${lineChartClassNames.lineChartMouseLine},
|
|
1528
|
-
.${lineChartClassNames.lineChartMouseCircle} {
|
|
1529
|
-
transition: opacity linear 200ms;
|
|
1530
|
-
pointer-events: none;
|
|
1531
|
-
stroke-width: 1px;
|
|
1532
|
-
}
|
|
1533
|
-
|
|
1534
|
-
.${lineChartClassNames.lineChartDot} {
|
|
1535
|
-
stroke: #fff;
|
|
1536
|
-
stroke-width: 2px;
|
|
1537
|
-
}
|
|
1538
|
-
|
|
1539
|
-
.${lineChartClassNames.lineChartMouseLine} {
|
|
1540
|
-
shape-rendering: crispEdges;
|
|
1541
|
-
}
|
|
1542
|
-
|
|
1543
|
-
.${lineChartClassNames.lineChartMouseRect} {
|
|
1544
|
-
fill: none;
|
|
1545
|
-
pointer-events: all;
|
|
1546
|
-
}
|
|
1558
|
+
const SvgWrapper$2 = styled(Wrapper) `
|
|
1559
|
+
.${lineChartClassNames.lineChartYScaleGlobal},
|
|
1560
|
+
.${lineChartClassNames.lineChartXScaleGlobal},
|
|
1561
|
+
.${lineChartClassNames.lineChartGridGlobal} {
|
|
1562
|
+
shape-rendering: crispEdges;
|
|
1563
|
+
}
|
|
1564
|
+
|
|
1565
|
+
.${lineChartClassNames.lineChartLinesGlobal} {
|
|
1566
|
+
fill: none;
|
|
1567
|
+
stroke: steelblue;
|
|
1568
|
+
stroke-width: 1.5px;
|
|
1569
|
+
stroke-linejoin: round;
|
|
1570
|
+
stroke-linecap: round;
|
|
1571
|
+
}
|
|
1572
|
+
|
|
1573
|
+
.${lineChartClassNames.lineChartArea} {
|
|
1574
|
+
fill-opacity: 0.24;
|
|
1575
|
+
}
|
|
1576
|
+
|
|
1577
|
+
.${lineChartClassNames.lineChartGridLineX},
|
|
1578
|
+
.${lineChartClassNames.lineChartGridLineY},
|
|
1579
|
+
.${lineChartClassNames.lineChartMouseLine} {
|
|
1580
|
+
stroke: rgba(149, 149, 149, 0.24);
|
|
1581
|
+
}
|
|
1582
|
+
|
|
1583
|
+
.${lineChartClassNames.lineChartMouseLine},
|
|
1584
|
+
.${lineChartClassNames.lineChartMouseCircle} {
|
|
1585
|
+
transition: opacity linear 200ms;
|
|
1586
|
+
pointer-events: none;
|
|
1587
|
+
stroke-width: 1px;
|
|
1588
|
+
}
|
|
1589
|
+
|
|
1590
|
+
.${lineChartClassNames.lineChartDot} {
|
|
1591
|
+
stroke: #fff;
|
|
1592
|
+
stroke-width: 2px;
|
|
1593
|
+
}
|
|
1594
|
+
|
|
1595
|
+
.${lineChartClassNames.lineChartMouseLine} {
|
|
1596
|
+
shape-rendering: crispEdges;
|
|
1597
|
+
}
|
|
1598
|
+
|
|
1599
|
+
.${lineChartClassNames.lineChartMouseRect} {
|
|
1600
|
+
fill: none;
|
|
1601
|
+
pointer-events: all;
|
|
1602
|
+
}
|
|
1547
1603
|
`;
|
|
1548
|
-
const TooltipStyles$2 = styled.createGlobalStyle `
|
|
1549
|
-
.${lineChartClassNames.lineChartMouseLabel} {
|
|
1550
|
-
transition: opacity linear 200ms;
|
|
1551
|
-
z-index: 100;
|
|
1552
|
-
|
|
1553
|
-
.${lineChartClassNames.lineChartLabelFlex} {
|
|
1554
|
-
justify-content: flex-start;
|
|
1555
|
-
align-items: center;
|
|
1556
|
-
pointer-events: none;
|
|
1557
|
-
}
|
|
1558
|
-
|
|
1559
|
-
.${lineChartClassNames.lineChartLabel} {
|
|
1560
|
-
margin: 0 0 0 10px;
|
|
1561
|
-
}
|
|
1562
|
-
}
|
|
1604
|
+
const TooltipStyles$2 = styled.createGlobalStyle `
|
|
1605
|
+
.${lineChartClassNames.lineChartMouseLabel} {
|
|
1606
|
+
transition: opacity linear 200ms;
|
|
1607
|
+
z-index: 100;
|
|
1608
|
+
|
|
1609
|
+
.${lineChartClassNames.lineChartLabelFlex} {
|
|
1610
|
+
justify-content: flex-start;
|
|
1611
|
+
align-items: center;
|
|
1612
|
+
pointer-events: none;
|
|
1613
|
+
}
|
|
1614
|
+
|
|
1615
|
+
.${lineChartClassNames.lineChartLabel} {
|
|
1616
|
+
margin: 0 0 0 10px;
|
|
1617
|
+
}
|
|
1618
|
+
}
|
|
1563
1619
|
`;
|
|
1564
1620
|
|
|
1565
1621
|
const drawGrid$2 = ({ svg, yScale, xScale, yTicksCount, lastIndex, drawGridX, drawGridY, }) => {
|
|
@@ -1595,17 +1651,17 @@ const drawGrid$2 = ({ svg, yScale, xScale, yTicksCount, lastIndex, drawGridX, dr
|
|
|
1595
1651
|
}
|
|
1596
1652
|
};
|
|
1597
1653
|
|
|
1598
|
-
const LabelContainer = styled.div `
|
|
1599
|
-
width: 0;
|
|
1600
|
-
height: 0;
|
|
1601
|
-
display: flex;
|
|
1602
|
-
align-items: flex-end;
|
|
1603
|
-
justify-content: center;
|
|
1604
|
-
font-size: 12px;
|
|
1605
|
-
white-space: nowrap;
|
|
1654
|
+
const LabelContainer = styled.div `
|
|
1655
|
+
width: 0;
|
|
1656
|
+
height: 0;
|
|
1657
|
+
display: flex;
|
|
1658
|
+
align-items: flex-end;
|
|
1659
|
+
justify-content: center;
|
|
1660
|
+
font-size: 12px;
|
|
1661
|
+
white-space: nowrap;
|
|
1606
1662
|
`;
|
|
1607
|
-
const Label = styled.div `
|
|
1608
|
-
margin-bottom: 4px;
|
|
1663
|
+
const Label = styled.div `
|
|
1664
|
+
margin-bottom: 4px;
|
|
1609
1665
|
`;
|
|
1610
1666
|
|
|
1611
1667
|
const labelClassName = "d3-chart-label";
|
|
@@ -1848,7 +1904,7 @@ const drawTooltip$2 = ({ svg, node, data: argData, xScale, yScale, dynamicCircle
|
|
|
1848
1904
|
};
|
|
1849
1905
|
|
|
1850
1906
|
const draw$2 = (node, props) => {
|
|
1851
|
-
const { data: chartData, labels, margin, customYAxisSelection, customXAxisSelection, customYAxis, customXAxis, curve, yAxisPadding, xAxisPadding, drawGridY, drawGridX, withLabels, formatLabel, eachLabel, stacked, dynamicTooltipEnable, dynamicCircleRadius, formatDynamicTooltip, renderTooltip, stackedTooltip, stackedTooltipIndex, tooltipLineTop, customize, customYScale, customLine, tooltipClassName, xScaleItemWidth, areaCurve, dotSnapping, rightAxis, markers, } = props;
|
|
1907
|
+
const { data: chartData, labels, margin, customYAxisSelection, customXAxisSelection, customYAxis, customXAxis, curve, yAxisPadding, xAxisPadding, drawGridY, drawGridX, withLabels, formatLabel, eachLabel, stacked, dynamicTooltipEnable, dynamicCircleRadius, formatDynamicTooltip, renderTooltip, stackedTooltip, stackedTooltipIndex, tooltipLineTop, customize, customYScale, customLine, tooltipClassName, xScaleItemWidth, areaCurve, dotSnapping, rightAxis, markers, transitionDuration = 300, } = props;
|
|
1852
1908
|
if (node !== null && chartData.length) {
|
|
1853
1909
|
const data = stacked ? stackedData(chartData) : chartData;
|
|
1854
1910
|
const marginTop = margin ? margin.top : 0;
|
|
@@ -1864,6 +1920,14 @@ const draw$2 = (node, props) => {
|
|
|
1864
1920
|
const max = typeof props.max === 'number'
|
|
1865
1921
|
? props.max
|
|
1866
1922
|
: d3__namespace.max(data, ({ values }) => d3__namespace.max(values));
|
|
1923
|
+
const prevStrokes = new Map();
|
|
1924
|
+
if (transitionDuration > 0) {
|
|
1925
|
+
d3__namespace.select(node)
|
|
1926
|
+
.selectAll(`svg .${lineChartClassNames.lineChartLinesGlobal} .${lineChartClassNames.lineChartLine}`)
|
|
1927
|
+
.each(function (_, i) {
|
|
1928
|
+
prevStrokes.set(i, d3__namespace.select(this).attr('stroke') || '');
|
|
1929
|
+
});
|
|
1930
|
+
}
|
|
1867
1931
|
const svg = appendSvg(node, width, height || 0);
|
|
1868
1932
|
const yRange = [
|
|
1869
1933
|
height - marginTop - marginBottom - (xAxisPadding || 0),
|
|
@@ -2002,7 +2066,7 @@ const draw$2 = (node, props) => {
|
|
|
2002
2066
|
.attr('fill', ({ fill }) => fill || 'none')
|
|
2003
2067
|
.attr('style', ({ areaStyle }) => areaStyle || '');
|
|
2004
2068
|
}
|
|
2005
|
-
svg
|
|
2069
|
+
const lineSelection = svg
|
|
2006
2070
|
.append('g')
|
|
2007
2071
|
.attr('class', lineChartClassNames.lineChartLinesGlobal)
|
|
2008
2072
|
.selectAll('path')
|
|
@@ -2010,8 +2074,17 @@ const draw$2 = (node, props) => {
|
|
|
2010
2074
|
.join('path')
|
|
2011
2075
|
.attr('class', lineChartClassNames.lineChartLine)
|
|
2012
2076
|
.attr('d', (d) => line(d.values))
|
|
2013
|
-
.attr('stroke', ({ stroke }) => stroke || 'steelblue')
|
|
2014
2077
|
.attr('style', ({ style }) => style || '');
|
|
2078
|
+
if (transitionDuration > 0 && prevStrokes.size > 0) {
|
|
2079
|
+
lineSelection
|
|
2080
|
+
.attr('stroke', (_, i) => prevStrokes.get(i) || (data[i]?.stroke || 'steelblue'))
|
|
2081
|
+
.transition()
|
|
2082
|
+
.duration(transitionDuration)
|
|
2083
|
+
.attr('stroke', ({ stroke }) => stroke || 'steelblue');
|
|
2084
|
+
}
|
|
2085
|
+
else {
|
|
2086
|
+
lineSelection.attr('stroke', ({ stroke }) => stroke || 'steelblue');
|
|
2087
|
+
}
|
|
2015
2088
|
const dots = data.filter(({ dot }) => dot);
|
|
2016
2089
|
if (dots.length > 0) {
|
|
2017
2090
|
const dotsGlobal = svg
|
|
@@ -2199,66 +2272,66 @@ const barChartClassNames = {
|
|
|
2199
2272
|
...labelClassnames,
|
|
2200
2273
|
...barChartLinesClassNames,
|
|
2201
2274
|
};
|
|
2202
|
-
const SvgWrapper$1 = styled(Wrapper) `
|
|
2203
|
-
display: ${({ selectable }) => selectable && "inline-block"};
|
|
2204
|
-
user-select: ${({ selectable }) => selectable && "none"};
|
|
2205
|
-
width: ${({ selectable }) => selectable && "auto"};
|
|
2206
|
-
|
|
2207
|
-
line {
|
|
2208
|
-
stroke-width: 1px;
|
|
2209
|
-
shape-rendering: crispEdges;
|
|
2210
|
-
}
|
|
2211
|
-
|
|
2212
|
-
.${barChartClassNames.barChartGridLineX},
|
|
2213
|
-
.${barChartClassNames.barChartGridLineY} {
|
|
2214
|
-
stroke: rgba(48, 69, 79, 0.06);
|
|
2215
|
-
}
|
|
2216
|
-
|
|
2217
|
-
.${barChartClassNames.barChartMouseRect} {
|
|
2218
|
-
}
|
|
2219
|
-
|
|
2220
|
-
.${barChartClassNames.barChartMouseRect} {
|
|
2221
|
-
fill: none;
|
|
2222
|
-
pointer-events: all;
|
|
2223
|
-
}
|
|
2224
|
-
|
|
2225
|
-
.${barChartClassNames.barChartLinesGlobal} {
|
|
2226
|
-
stroke-width: 1.5px;
|
|
2227
|
-
stroke-linejoin: round;
|
|
2228
|
-
stroke-linecap: round;
|
|
2229
|
-
}
|
|
2230
|
-
|
|
2231
|
-
.${barChartClassNames.barChartLine} {
|
|
2232
|
-
shape-rendering: auto;
|
|
2233
|
-
}
|
|
2234
|
-
|
|
2235
|
-
.${barChartClassNames.barChartArea} {
|
|
2236
|
-
fill-opacity: 0.24;
|
|
2237
|
-
}
|
|
2238
|
-
|
|
2239
|
-
.${barChartClassNames.barChartSelection} {
|
|
2240
|
-
position: absolute;
|
|
2241
|
-
top: 0;
|
|
2242
|
-
width: 0;
|
|
2243
|
-
background: rgba(0, 170, 255, 0.06);
|
|
2244
|
-
box-shadow: 1px 0 0 #00AAFF, -1px 0 0 #00AAFF;
|
|
2245
|
-
pointer-events: none;
|
|
2246
|
-
}
|
|
2275
|
+
const SvgWrapper$1 = styled(Wrapper) `
|
|
2276
|
+
display: ${({ selectable }) => selectable && "inline-block"};
|
|
2277
|
+
user-select: ${({ selectable }) => selectable && "none"};
|
|
2278
|
+
width: ${({ selectable }) => selectable && "auto"};
|
|
2279
|
+
|
|
2280
|
+
line {
|
|
2281
|
+
stroke-width: 1px;
|
|
2282
|
+
shape-rendering: crispEdges;
|
|
2283
|
+
}
|
|
2284
|
+
|
|
2285
|
+
.${barChartClassNames.barChartGridLineX},
|
|
2286
|
+
.${barChartClassNames.barChartGridLineY} {
|
|
2287
|
+
stroke: rgba(48, 69, 79, 0.06);
|
|
2288
|
+
}
|
|
2289
|
+
|
|
2290
|
+
.${barChartClassNames.barChartMouseRect} {
|
|
2291
|
+
}
|
|
2292
|
+
|
|
2293
|
+
.${barChartClassNames.barChartMouseRect} {
|
|
2294
|
+
fill: none;
|
|
2295
|
+
pointer-events: all;
|
|
2296
|
+
}
|
|
2297
|
+
|
|
2298
|
+
.${barChartClassNames.barChartLinesGlobal} {
|
|
2299
|
+
stroke-width: 1.5px;
|
|
2300
|
+
stroke-linejoin: round;
|
|
2301
|
+
stroke-linecap: round;
|
|
2302
|
+
}
|
|
2303
|
+
|
|
2304
|
+
.${barChartClassNames.barChartLine} {
|
|
2305
|
+
shape-rendering: auto;
|
|
2306
|
+
}
|
|
2307
|
+
|
|
2308
|
+
.${barChartClassNames.barChartArea} {
|
|
2309
|
+
fill-opacity: 0.24;
|
|
2310
|
+
}
|
|
2311
|
+
|
|
2312
|
+
.${barChartClassNames.barChartSelection} {
|
|
2313
|
+
position: absolute;
|
|
2314
|
+
top: 0;
|
|
2315
|
+
width: 0;
|
|
2316
|
+
background: rgba(0, 170, 255, 0.06);
|
|
2317
|
+
box-shadow: 1px 0 0 #00AAFF, -1px 0 0 #00AAFF;
|
|
2318
|
+
pointer-events: none;
|
|
2319
|
+
}
|
|
2247
2320
|
`;
|
|
2248
|
-
const TooltipStyles$1 = styled.createGlobalStyle `
|
|
2249
|
-
.${barChartClassNames.barChartMouseTooltip} {
|
|
2250
|
-
z-index: 100;
|
|
2251
|
-
transition: all linear 144ms;
|
|
2252
|
-
|
|
2253
|
-
.${barChartClassNames.barChartTooltipItem} {
|
|
2254
|
-
padding: 0.125rem;
|
|
2255
|
-
margin-bottom: 4px;
|
|
2256
|
-
|
|
2257
|
-
:last-of-type {
|
|
2258
|
-
margin-bottom: 0;
|
|
2259
|
-
}
|
|
2260
|
-
}
|
|
2261
|
-
}
|
|
2321
|
+
const TooltipStyles$1 = styled.createGlobalStyle `
|
|
2322
|
+
.${barChartClassNames.barChartMouseTooltip} {
|
|
2323
|
+
z-index: 100;
|
|
2324
|
+
transition: all linear 144ms;
|
|
2325
|
+
|
|
2326
|
+
.${barChartClassNames.barChartTooltipItem} {
|
|
2327
|
+
padding: 0.125rem;
|
|
2328
|
+
margin-bottom: 4px;
|
|
2329
|
+
|
|
2330
|
+
:last-of-type {
|
|
2331
|
+
margin-bottom: 0;
|
|
2332
|
+
}
|
|
2333
|
+
}
|
|
2334
|
+
}
|
|
2262
2335
|
`;
|
|
2263
2336
|
|
|
2264
2337
|
const useSelection = (node, props) => {
|
|
@@ -2802,7 +2875,7 @@ const getBars = ({ groups, barWidth }) => {
|
|
|
2802
2875
|
|
|
2803
2876
|
const MIN_BAR_HEIGHT = 2;
|
|
2804
2877
|
const draw$1 = (node, props) => {
|
|
2805
|
-
const { data, lineData = [], markers = [], barWidth: barWidthProp, barPadding, colors, margin, xAxisPadding, yAxisPadding, drawGridY, drawGridX, customYScale, customXScale, customYAxisLeft, customXAxisBottom, customYAxis, customXAxis, customBars, customize, dynamicTooltipEnable, hideTooltipGroupName, renderTooltip, labelPosition, renderLabel, tooltipY, tooltipBind, stackedLine, curve, formatTooltipValue, formatTooltipName, sectionPadding, minValuesLine, tooltipYDomain, marshalledMap, minValue, maxValue, minDomainValue, maxDomainValue, drawBars, setTooltipPosition, onLabelItem, isBarTooltip, xScaleItemWidth, tooltipRoot, tooltipClassName, onBarClick, onBarHover, } = props;
|
|
2878
|
+
const { data, lineData = [], markers = [], barWidth: barWidthProp, barPadding, colors, margin, xAxisPadding, yAxisPadding, drawGridY, drawGridX, customYScale, customXScale, customYAxisLeft, customXAxisBottom, customYAxis, customXAxis, customBars, customize, dynamicTooltipEnable, hideTooltipGroupName, renderTooltip, labelPosition, renderLabel, tooltipY, tooltipBind, stackedLine, curve, formatTooltipValue, formatTooltipName, sectionPadding, minValuesLine, tooltipYDomain, marshalledMap, minValue, maxValue, minDomainValue, maxDomainValue, drawBars, setTooltipPosition, onLabelItem, isBarTooltip, xScaleItemWidth, tooltipRoot, tooltipClassName, onBarClick, onBarHover, transitionDuration = 300, } = props;
|
|
2806
2879
|
if (node !== null && data.length) {
|
|
2807
2880
|
const marginTop = margin?.top ?? 0;
|
|
2808
2881
|
const marginRight = margin?.right ?? 0;
|
|
@@ -2825,6 +2898,20 @@ const draw$1 = (node, props) => {
|
|
|
2825
2898
|
? maxValue
|
|
2826
2899
|
: Math.max(d3__namespace.max(lineData, ({ values }) => d3__namespace.max(values)) ||
|
|
2827
2900
|
Number.NEGATIVE_INFINITY, barDomain.max);
|
|
2901
|
+
const prevBarFills = new Map();
|
|
2902
|
+
if (transitionDuration > 0) {
|
|
2903
|
+
d3__namespace.select(node)
|
|
2904
|
+
.selectAll(`svg .${barChartClassNames.barChartBarGlobal} g`)
|
|
2905
|
+
.each(function (_, groupIdx) {
|
|
2906
|
+
d3__namespace.select(this).selectAll('rect')
|
|
2907
|
+
.each(function (_, rectIdx) {
|
|
2908
|
+
const fill = this.style.fill;
|
|
2909
|
+
if (fill) {
|
|
2910
|
+
prevBarFills.set(`${groupIdx}-${rectIdx}`, fill);
|
|
2911
|
+
}
|
|
2912
|
+
});
|
|
2913
|
+
});
|
|
2914
|
+
}
|
|
2828
2915
|
const svg = appendSvg(node, width, height || 0);
|
|
2829
2916
|
const yTicksCountDefault = 4;
|
|
2830
2917
|
const labels = data.map((item) => item.groupName);
|
|
@@ -2979,6 +3066,24 @@ const draw$1 = (node, props) => {
|
|
|
2979
3066
|
});
|
|
2980
3067
|
}
|
|
2981
3068
|
customize && customize({ svg, marshalledData, yScale, xScale, lineData });
|
|
3069
|
+
if (transitionDuration > 0 && prevBarFills.size > 0) {
|
|
3070
|
+
d3__namespace.select(node)
|
|
3071
|
+
.selectAll(`.${barChartClassNames.barChartBarGlobal} g`)
|
|
3072
|
+
.each(function (_, groupIdx) {
|
|
3073
|
+
d3__namespace.select(this).selectAll('rect')
|
|
3074
|
+
.each(function (_, rectIdx) {
|
|
3075
|
+
const prevFill = prevBarFills.get(`${groupIdx}-${rectIdx}`);
|
|
3076
|
+
const currentFill = this.style.fill;
|
|
3077
|
+
if (prevFill && prevFill !== currentFill) {
|
|
3078
|
+
d3__namespace.select(this)
|
|
3079
|
+
.style('fill', prevFill)
|
|
3080
|
+
.transition()
|
|
3081
|
+
.duration(transitionDuration)
|
|
3082
|
+
.style('fill', currentFill);
|
|
3083
|
+
}
|
|
3084
|
+
});
|
|
3085
|
+
});
|
|
3086
|
+
}
|
|
2982
3087
|
}
|
|
2983
3088
|
};
|
|
2984
3089
|
|
|
@@ -3066,45 +3171,45 @@ const horizontalBarChartClassNames = {
|
|
|
3066
3171
|
horizontalBarChartTooltipName: "horizontalBarChartTooltipName",
|
|
3067
3172
|
horizontalBarChartTooltipValue: "horizontalBarChartTooltipValue",
|
|
3068
3173
|
};
|
|
3069
|
-
const Table = styled.table `
|
|
3070
|
-
width: 100%;
|
|
3174
|
+
const Table = styled.table `
|
|
3175
|
+
width: 100%;
|
|
3071
3176
|
`;
|
|
3072
|
-
const LabelCell = styled.div `
|
|
3073
|
-
text-align: right;
|
|
3177
|
+
const LabelCell = styled.div `
|
|
3178
|
+
text-align: right;
|
|
3074
3179
|
`;
|
|
3075
|
-
const BarFlex = styled.div `
|
|
3076
|
-
width: 100%;
|
|
3077
|
-
display: flex;
|
|
3078
|
-
height: 1rem;
|
|
3180
|
+
const BarFlex = styled.div `
|
|
3181
|
+
width: 100%;
|
|
3182
|
+
display: flex;
|
|
3183
|
+
height: 1rem;
|
|
3079
3184
|
`;
|
|
3080
|
-
const BarsTd = styled.td `
|
|
3081
|
-
width: 100%;
|
|
3082
|
-
position: relative;
|
|
3083
|
-
vertical-align: middle;
|
|
3185
|
+
const BarsTd = styled.td `
|
|
3186
|
+
width: 100%;
|
|
3187
|
+
position: relative;
|
|
3188
|
+
vertical-align: middle;
|
|
3084
3189
|
`;
|
|
3085
|
-
const TooltipFlex = styled(TooltipFlex$1) `
|
|
3086
|
-
position: absolute;
|
|
3087
|
-
top: 0;
|
|
3088
|
-
left: 50%;
|
|
3089
|
-
transform: translate(-50%, -50%);
|
|
3090
|
-
will-change: left, top;
|
|
3190
|
+
const TooltipFlex = styled(TooltipFlex$1) `
|
|
3191
|
+
position: absolute;
|
|
3192
|
+
top: 0;
|
|
3193
|
+
left: 50%;
|
|
3194
|
+
transform: translate(-50%, -50%);
|
|
3195
|
+
will-change: left, top;
|
|
3091
3196
|
`;
|
|
3092
|
-
const StackSumContainer = styled.div `
|
|
3093
|
-
position: relative;
|
|
3197
|
+
const StackSumContainer = styled.div `
|
|
3198
|
+
position: relative;
|
|
3094
3199
|
`;
|
|
3095
|
-
const StackSum = styled.div `
|
|
3096
|
-
white-space: nowrap;
|
|
3097
|
-
position: absolute;
|
|
3098
|
-
top: 50%;
|
|
3099
|
-
left: 50%;
|
|
3100
|
-
transform: translate(0, -50%);
|
|
3200
|
+
const StackSum = styled.div `
|
|
3201
|
+
white-space: nowrap;
|
|
3202
|
+
position: absolute;
|
|
3203
|
+
top: 50%;
|
|
3204
|
+
left: 50%;
|
|
3205
|
+
transform: translate(0, -50%);
|
|
3101
3206
|
`;
|
|
3102
|
-
const StackWrapper = styled.div `
|
|
3103
|
-
position: absolute;
|
|
3104
|
-
top: 0;
|
|
3105
|
-
display: flex;
|
|
3106
|
-
justify-content: flex-start;
|
|
3107
|
-
height: 100%;
|
|
3207
|
+
const StackWrapper = styled.div `
|
|
3208
|
+
position: absolute;
|
|
3209
|
+
top: 0;
|
|
3210
|
+
display: flex;
|
|
3211
|
+
justify-content: flex-start;
|
|
3212
|
+
height: 100%;
|
|
3108
3213
|
`;
|
|
3109
3214
|
|
|
3110
3215
|
const Tooltip$1 = ({ renderTooltip, bars, style, className, }) => {
|
|
@@ -3156,10 +3261,10 @@ const useStackWrapper = (stackedTooltip) => {
|
|
|
3156
3261
|
: ({ children }) => (jsxRuntime.jsx(react.Fragment, { children: children })), [stackedTooltip]);
|
|
3157
3262
|
};
|
|
3158
3263
|
|
|
3159
|
-
const BarStyled = styled.div `
|
|
3160
|
-
position: relative;
|
|
3161
|
-
display: inline-flex;
|
|
3162
|
-
height: 100%;
|
|
3264
|
+
const BarStyled = styled.div `
|
|
3265
|
+
position: relative;
|
|
3266
|
+
display: inline-flex;
|
|
3267
|
+
height: 100%;
|
|
3163
3268
|
`;
|
|
3164
3269
|
|
|
3165
3270
|
const Bar = ({ withTooltip, bar, formatNativeTitle, tooltipBind, mouseMove, mouseLeave, pointerEventsNone, isFirstChild, isLastChild, isOnlyChild, }) => {
|
|
@@ -3176,23 +3281,23 @@ const Bar = ({ withTooltip, bar, formatNativeTitle, tooltipBind, mouseMove, mous
|
|
|
3176
3281
|
}, title: formatNativeTitle ? formatNativeTitle(bar) : "", onMouseOver: onMouseMove, onMouseMove: tooltipBind ? onMouseMove : void 0, onMouseOut: onMouseLeave }));
|
|
3177
3282
|
};
|
|
3178
3283
|
|
|
3179
|
-
const TickTd = styled.td `
|
|
3180
|
-
position: relative;
|
|
3284
|
+
const TickTd = styled.td `
|
|
3285
|
+
position: relative;
|
|
3181
3286
|
`;
|
|
3182
|
-
const Ticks = styled.div `
|
|
3183
|
-
position: relative;
|
|
3184
|
-
height: 1rem;
|
|
3287
|
+
const Ticks = styled.div `
|
|
3288
|
+
position: relative;
|
|
3289
|
+
height: 1rem;
|
|
3185
3290
|
`;
|
|
3186
|
-
const Tick = styled.div `
|
|
3187
|
-
white-space: nowrap;
|
|
3188
|
-
width: 0;
|
|
3189
|
-
height: 0;
|
|
3190
|
-
position: absolute;
|
|
3191
|
-
top: 50%;
|
|
3192
|
-
transform: translateY(-50%);
|
|
3193
|
-
display: flex;
|
|
3194
|
-
align-items: center;
|
|
3195
|
-
justify-content: center;
|
|
3291
|
+
const Tick = styled.div `
|
|
3292
|
+
white-space: nowrap;
|
|
3293
|
+
width: 0;
|
|
3294
|
+
height: 0;
|
|
3295
|
+
position: absolute;
|
|
3296
|
+
top: 50%;
|
|
3297
|
+
transform: translateY(-50%);
|
|
3298
|
+
display: flex;
|
|
3299
|
+
align-items: center;
|
|
3300
|
+
justify-content: center;
|
|
3196
3301
|
`;
|
|
3197
3302
|
|
|
3198
3303
|
const hundred = 100;
|
|
@@ -3291,29 +3396,29 @@ const bubbleChartClassNames = {
|
|
|
3291
3396
|
bubbleChartTooltipFlex: "bubbleChartTooltipFlex",
|
|
3292
3397
|
bubbleChartTip: "bubbleChartTip",
|
|
3293
3398
|
};
|
|
3294
|
-
const SvgWrapper = styled(Wrapper) `
|
|
3295
|
-
.${bubbleChartClassNames.bubbleChartYAxis},
|
|
3296
|
-
.${bubbleChartClassNames.bubbleChartXAxis},
|
|
3297
|
-
.${bubbleChartClassNames.bubbleChartGridGlobal} {
|
|
3298
|
-
shape-rendering: crispEdges;
|
|
3299
|
-
}
|
|
3300
|
-
|
|
3301
|
-
.${bubbleChartClassNames.bubbleChartGridLineX},
|
|
3302
|
-
.${bubbleChartClassNames.bubbleChartGridLineY} {
|
|
3303
|
-
stroke: rgba(149, 149, 149, 0.24);
|
|
3304
|
-
}
|
|
3305
|
-
|
|
3306
|
-
.${bubbleChartClassNames.bubbleChartYScaleLabel} {
|
|
3307
|
-
font-size: 10px;
|
|
3308
|
-
}
|
|
3399
|
+
const SvgWrapper = styled(Wrapper) `
|
|
3400
|
+
.${bubbleChartClassNames.bubbleChartYAxis},
|
|
3401
|
+
.${bubbleChartClassNames.bubbleChartXAxis},
|
|
3402
|
+
.${bubbleChartClassNames.bubbleChartGridGlobal} {
|
|
3403
|
+
shape-rendering: crispEdges;
|
|
3404
|
+
}
|
|
3405
|
+
|
|
3406
|
+
.${bubbleChartClassNames.bubbleChartGridLineX},
|
|
3407
|
+
.${bubbleChartClassNames.bubbleChartGridLineY} {
|
|
3408
|
+
stroke: rgba(149, 149, 149, 0.24);
|
|
3409
|
+
}
|
|
3410
|
+
|
|
3411
|
+
.${bubbleChartClassNames.bubbleChartYScaleLabel} {
|
|
3412
|
+
font-size: 10px;
|
|
3413
|
+
}
|
|
3309
3414
|
`;
|
|
3310
|
-
const TooltipStyles = styled.createGlobalStyle `
|
|
3311
|
-
.${bubbleChartClassNames.bubbleChartTooltipContainer} {
|
|
3312
|
-
position: absolute;
|
|
3313
|
-
transition: opacity 150ms cubic-bezier(0.2, 1, 0.6, 1);
|
|
3314
|
-
pointer-events: none;
|
|
3315
|
-
z-index: 1;
|
|
3316
|
-
}
|
|
3415
|
+
const TooltipStyles = styled.createGlobalStyle `
|
|
3416
|
+
.${bubbleChartClassNames.bubbleChartTooltipContainer} {
|
|
3417
|
+
position: absolute;
|
|
3418
|
+
transition: opacity 150ms cubic-bezier(0.2, 1, 0.6, 1);
|
|
3419
|
+
pointer-events: none;
|
|
3420
|
+
z-index: 1;
|
|
3421
|
+
}
|
|
3317
3422
|
`;
|
|
3318
3423
|
|
|
3319
3424
|
const drawGrid = ({ svg, yScale, xScale, yTicksCount, drawGridX, drawGridY, }) => {
|
|
@@ -3350,14 +3455,14 @@ const drawGrid = ({ svg, yScale, xScale, yTicksCount, drawGridX, drawGridY, }) =
|
|
|
3350
3455
|
}
|
|
3351
3456
|
};
|
|
3352
3457
|
|
|
3353
|
-
const Tooltip = styled.div `
|
|
3354
|
-
width: 0;
|
|
3355
|
-
height: 0;
|
|
3356
|
-
display: flex;
|
|
3357
|
-
align-items: flex-end;
|
|
3358
|
-
justify-content: center;
|
|
3359
|
-
font-size: 12px;
|
|
3360
|
-
white-space: nowrap;
|
|
3458
|
+
const Tooltip = styled.div `
|
|
3459
|
+
width: 0;
|
|
3460
|
+
height: 0;
|
|
3461
|
+
display: flex;
|
|
3462
|
+
align-items: flex-end;
|
|
3463
|
+
justify-content: center;
|
|
3464
|
+
font-size: 12px;
|
|
3465
|
+
white-space: nowrap;
|
|
3361
3466
|
`;
|
|
3362
3467
|
|
|
3363
3468
|
const drawTooltip = ({ bubbles, tooltipRoot, tooltipClassName, renderTooltip, }) => {
|