@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/charts.esm.js
CHANGED
|
@@ -6,10 +6,10 @@ import ReactDOMServer from 'react-dom/server';
|
|
|
6
6
|
import { uniqueId } from 'lodash';
|
|
7
7
|
import { unmountComponentAtNode, render } from 'react-dom';
|
|
8
8
|
|
|
9
|
-
const Wrapper = styled.div `
|
|
10
|
-
position: relative;
|
|
11
|
-
width: 100%;
|
|
12
|
-
box-sizing: border-box;
|
|
9
|
+
const Wrapper = styled.div `
|
|
10
|
+
position: relative;
|
|
11
|
+
width: 100%;
|
|
12
|
+
box-sizing: border-box;
|
|
13
13
|
`;
|
|
14
14
|
|
|
15
15
|
function useNode() {
|
|
@@ -107,10 +107,10 @@ const drawMarkers = ({ svg, markers, width, left, top, count, yScale }) => {
|
|
|
107
107
|
});
|
|
108
108
|
};
|
|
109
109
|
|
|
110
|
-
const SwipeScrollContainer = styled.div `
|
|
111
|
-
width: 100%;
|
|
112
|
-
overflow: hidden;
|
|
113
|
-
user-select: none;
|
|
110
|
+
const SwipeScrollContainer = styled.div `
|
|
111
|
+
width: 100%;
|
|
112
|
+
overflow: hidden;
|
|
113
|
+
user-select: none;
|
|
114
114
|
`;
|
|
115
115
|
|
|
116
116
|
function animate({ duration, timing, draw, }) {
|
|
@@ -262,37 +262,37 @@ const getTranslate$1 = ({ anchor, index, translateX, translateY, }) => {
|
|
|
262
262
|
}
|
|
263
263
|
return `translate(${translateX}px, ${translateY}px)`;
|
|
264
264
|
};
|
|
265
|
-
const Label$2 = styled.div `
|
|
266
|
-
display: flex;
|
|
267
|
-
align-items: center;
|
|
268
|
-
font-size: 12px;
|
|
265
|
+
const Label$2 = styled.div `
|
|
266
|
+
display: flex;
|
|
267
|
+
align-items: center;
|
|
268
|
+
font-size: 12px;
|
|
269
269
|
`;
|
|
270
|
-
const Name$1 = styled.div `
|
|
271
|
-
text-align: center;
|
|
272
|
-
max-width: 120px;
|
|
270
|
+
const Name$1 = styled.div `
|
|
271
|
+
text-align: center;
|
|
272
|
+
max-width: 120px;
|
|
273
273
|
`;
|
|
274
|
-
const middleBadgeStyles = css `
|
|
275
|
-
position: absolute;
|
|
276
|
-
top: 50%;
|
|
277
|
-
right: 0;
|
|
278
|
-
transform: translate(calc(100% + 6px), -50%);
|
|
274
|
+
const middleBadgeStyles = css `
|
|
275
|
+
position: absolute;
|
|
276
|
+
top: 50%;
|
|
277
|
+
right: 0;
|
|
278
|
+
transform: translate(calc(100% + 6px), -50%);
|
|
279
279
|
`;
|
|
280
|
-
const DefaultBadge = styled.div `
|
|
281
|
-
display: flex;
|
|
282
|
-
align-items: center;
|
|
283
|
-
padding: 2px 4px;
|
|
284
|
-
border-radius: 4px;
|
|
285
|
-
color: rgb(255, 255, 255);
|
|
286
|
-
background-color: rgb(144, 197, 61);
|
|
287
|
-
margin-left: 8px;
|
|
280
|
+
const DefaultBadge = styled.div `
|
|
281
|
+
display: flex;
|
|
282
|
+
align-items: center;
|
|
283
|
+
padding: 2px 4px;
|
|
284
|
+
border-radius: 4px;
|
|
285
|
+
color: rgb(255, 255, 255);
|
|
286
|
+
background-color: rgb(144, 197, 61);
|
|
287
|
+
margin-left: 8px;
|
|
288
288
|
`;
|
|
289
|
-
const MiddleBadge = styled(DefaultBadge) `
|
|
290
|
-
${middleBadgeStyles}
|
|
289
|
+
const MiddleBadge = styled(DefaultBadge) `
|
|
290
|
+
${middleBadgeStyles}
|
|
291
291
|
`;
|
|
292
|
-
const BadgePrefix = styled.div `
|
|
293
|
-
margin-left: 4px;
|
|
294
|
-
font-size: 10px;
|
|
295
|
-
color: rgba(255, 255, 255, 0.54);
|
|
292
|
+
const BadgePrefix = styled.div `
|
|
293
|
+
margin-left: 4px;
|
|
294
|
+
font-size: 10px;
|
|
295
|
+
color: rgba(255, 255, 255, 0.54);
|
|
296
296
|
`;
|
|
297
297
|
|
|
298
298
|
const radarChartclassNames = {
|
|
@@ -307,29 +307,29 @@ const radarChartclassNames = {
|
|
|
307
307
|
radarLabelBadgePrefix: 'radarLabelBadgePrefix',
|
|
308
308
|
radarCircle: 'radarCircle',
|
|
309
309
|
};
|
|
310
|
-
const SvgWrapper$5 = styled(Wrapper) `
|
|
311
|
-
.${radarChartclassNames.radarAxis} {
|
|
312
|
-
path,
|
|
313
|
-
line,
|
|
314
|
-
circle {
|
|
315
|
-
fill: none;
|
|
316
|
-
stroke-width: 1px;
|
|
317
|
-
stroke: rgba(149, 149, 149, 0.18);
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
.${radarChartclassNames.radarAxisText} {
|
|
321
|
-
font-size: 12px;
|
|
322
|
-
fill-opacity: 0.56;
|
|
323
|
-
}
|
|
324
|
-
.${radarChartclassNames.radarPolygon} {
|
|
325
|
-
fill-opacity: 0.06;
|
|
326
|
-
stroke-width: 2px;
|
|
327
|
-
fill: rgb(144, 197, 61);
|
|
328
|
-
stroke: rgb(144, 197, 61);
|
|
329
|
-
}
|
|
330
|
-
.${radarChartclassNames.radarCircle} {
|
|
331
|
-
fill: rgb(144, 197, 61);
|
|
332
|
-
}
|
|
310
|
+
const SvgWrapper$5 = styled(Wrapper) `
|
|
311
|
+
.${radarChartclassNames.radarAxis} {
|
|
312
|
+
path,
|
|
313
|
+
line,
|
|
314
|
+
circle {
|
|
315
|
+
fill: none;
|
|
316
|
+
stroke-width: 1px;
|
|
317
|
+
stroke: rgba(149, 149, 149, 0.18);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
.${radarChartclassNames.radarAxisText} {
|
|
321
|
+
font-size: 12px;
|
|
322
|
+
fill-opacity: 0.56;
|
|
323
|
+
}
|
|
324
|
+
.${radarChartclassNames.radarPolygon} {
|
|
325
|
+
fill-opacity: 0.06;
|
|
326
|
+
stroke-width: 2px;
|
|
327
|
+
fill: rgb(144, 197, 61);
|
|
328
|
+
stroke: rgb(144, 197, 61);
|
|
329
|
+
}
|
|
330
|
+
.${radarChartclassNames.radarCircle} {
|
|
331
|
+
fill: rgb(144, 197, 61);
|
|
332
|
+
}
|
|
333
333
|
`;
|
|
334
334
|
|
|
335
335
|
const getTranslate = ({ anchor, index, translateX, translateY, }) => {
|
|
@@ -351,8 +351,8 @@ const LabelContainer$1 = styled.div.attrs(props => ({
|
|
|
351
351
|
style: {
|
|
352
352
|
transform: getTranslate(props),
|
|
353
353
|
},
|
|
354
|
-
})) `
|
|
355
|
-
position: absolute;
|
|
354
|
+
})) `
|
|
355
|
+
position: absolute;
|
|
356
356
|
`;
|
|
357
357
|
|
|
358
358
|
const degByIndex = (index, count) => {
|
|
@@ -616,24 +616,24 @@ const pieChartclassNames = {
|
|
|
616
616
|
pieTooltipColorBox: 'pieTooltipColorBox',
|
|
617
617
|
pieFullChartTooltipCircle: 'pieFullChartTooltipCircle',
|
|
618
618
|
};
|
|
619
|
-
const SvgWrapper$4 = styled(Wrapper) `
|
|
620
|
-
.${pieChartclassNames.pieSliceLabel} {
|
|
621
|
-
fill: #4a4a4a;
|
|
622
|
-
}
|
|
623
|
-
|
|
624
|
-
.${pieChartclassNames.pieRadialLabel} {
|
|
625
|
-
position: absolute;
|
|
626
|
-
max-width: 128px;
|
|
627
|
-
}
|
|
628
|
-
|
|
629
|
-
.${pieChartclassNames.pieRadialLink} {
|
|
630
|
-
stroke: #000;
|
|
631
|
-
}
|
|
632
|
-
|
|
633
|
-
.${pieChartclassNames.pieFullChartTooltipCircle} {
|
|
634
|
-
fill: transparent;
|
|
635
|
-
cursor: pointer;
|
|
636
|
-
}
|
|
619
|
+
const SvgWrapper$4 = styled(Wrapper) `
|
|
620
|
+
.${pieChartclassNames.pieSliceLabel} {
|
|
621
|
+
fill: #4a4a4a;
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
.${pieChartclassNames.pieRadialLabel} {
|
|
625
|
+
position: absolute;
|
|
626
|
+
max-width: 128px;
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
.${pieChartclassNames.pieRadialLink} {
|
|
630
|
+
stroke: #000;
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
.${pieChartclassNames.pieFullChartTooltipCircle} {
|
|
634
|
+
fill: transparent;
|
|
635
|
+
cursor: pointer;
|
|
636
|
+
}
|
|
637
637
|
`;
|
|
638
638
|
|
|
639
639
|
function radiansToDegrees(radians) {
|
|
@@ -733,90 +733,90 @@ const drawRadialLabels = ({ arc, enableRadialLabels, global, node, radius, dataR
|
|
|
733
733
|
}
|
|
734
734
|
};
|
|
735
735
|
|
|
736
|
-
const TooltipFlex$1 = styled.div `
|
|
737
|
-
width: 0;
|
|
738
|
-
height: 0;
|
|
739
|
-
display: flex;
|
|
740
|
-
align-items: flex-end;
|
|
741
|
-
justify-content: center;
|
|
742
|
-
pointer-events: none;
|
|
743
|
-
white-space: nowrap;
|
|
736
|
+
const TooltipFlex$1 = styled.div `
|
|
737
|
+
width: 0;
|
|
738
|
+
height: 0;
|
|
739
|
+
display: flex;
|
|
740
|
+
align-items: flex-end;
|
|
741
|
+
justify-content: center;
|
|
742
|
+
pointer-events: none;
|
|
743
|
+
white-space: nowrap;
|
|
744
744
|
`;
|
|
745
745
|
const LabelFlex = styled(TooltipFlex$1) ``;
|
|
746
|
-
const LabelFlexCenter = styled(LabelFlex) `
|
|
747
|
-
align-items: center;
|
|
746
|
+
const LabelFlexCenter = styled(LabelFlex) `
|
|
747
|
+
align-items: center;
|
|
748
748
|
`;
|
|
749
|
-
const TooltipContainer = styled.div `
|
|
750
|
-
position: relative;
|
|
751
|
-
font-size: 11px;
|
|
752
|
-
color: #fff;
|
|
753
|
-
margin-bottom: 8px;
|
|
754
|
-
padding: 4px 6px;
|
|
755
|
-
background-color: rgba(48, 69, 79, 1);
|
|
756
|
-
border-radius: 4px;
|
|
757
|
-
box-shadow: 0 0.1875rem 0.5rem rgba(48, 69, 79, 0.06);
|
|
758
|
-
|
|
759
|
-
:before {
|
|
760
|
-
content: '';
|
|
761
|
-
position: absolute;
|
|
762
|
-
bottom: 0;
|
|
763
|
-
left: 50%;
|
|
764
|
-
transform: translate(-50%, 100%);
|
|
765
|
-
width: 0;
|
|
766
|
-
height: 0;
|
|
767
|
-
border-style: solid;
|
|
768
|
-
border-width: 4px 3px 0 3px;
|
|
769
|
-
border-color: rgba(48, 69, 79, 1) transparent transparent transparent;
|
|
770
|
-
}
|
|
749
|
+
const TooltipContainer = styled.div `
|
|
750
|
+
position: relative;
|
|
751
|
+
font-size: 11px;
|
|
752
|
+
color: #fff;
|
|
753
|
+
margin-bottom: 8px;
|
|
754
|
+
padding: 4px 6px;
|
|
755
|
+
background-color: rgba(48, 69, 79, 1);
|
|
756
|
+
border-radius: 4px;
|
|
757
|
+
box-shadow: 0 0.1875rem 0.5rem rgba(48, 69, 79, 0.06);
|
|
758
|
+
|
|
759
|
+
:before {
|
|
760
|
+
content: '';
|
|
761
|
+
position: absolute;
|
|
762
|
+
bottom: 0;
|
|
763
|
+
left: 50%;
|
|
764
|
+
transform: translate(-50%, 100%);
|
|
765
|
+
width: 0;
|
|
766
|
+
height: 0;
|
|
767
|
+
border-style: solid;
|
|
768
|
+
border-width: 4px 3px 0 3px;
|
|
769
|
+
border-color: rgba(48, 69, 79, 1) transparent transparent transparent;
|
|
770
|
+
}
|
|
771
771
|
`;
|
|
772
|
-
const TooltipGroupName = styled.div `
|
|
773
|
-
font-size: 14px;
|
|
774
|
-
margin-bottom: 6px;
|
|
772
|
+
const TooltipGroupName = styled.div `
|
|
773
|
+
font-size: 14px;
|
|
774
|
+
margin-bottom: 6px;
|
|
775
775
|
`;
|
|
776
|
-
const TooltipItem = styled.div `
|
|
777
|
-
display: flex;
|
|
778
|
-
align-items: center;
|
|
779
|
-
margin-bottom: 0.25rem;
|
|
780
|
-
|
|
781
|
-
&:last-of-type {
|
|
782
|
-
margin-bottom: 0;
|
|
783
|
-
}
|
|
776
|
+
const TooltipItem = styled.div `
|
|
777
|
+
display: flex;
|
|
778
|
+
align-items: center;
|
|
779
|
+
margin-bottom: 0.25rem;
|
|
780
|
+
|
|
781
|
+
&:last-of-type {
|
|
782
|
+
margin-bottom: 0;
|
|
783
|
+
}
|
|
784
784
|
`;
|
|
785
|
-
const ColFlex = styled.div `
|
|
786
|
-
display: flex;
|
|
787
|
-
align-items: center;
|
|
788
|
-
margin-right: 4px;
|
|
785
|
+
const ColFlex = styled.div `
|
|
786
|
+
display: flex;
|
|
787
|
+
align-items: center;
|
|
788
|
+
margin-right: 4px;
|
|
789
789
|
`;
|
|
790
|
-
const ColorBox = styled.div `
|
|
791
|
-
margin-right: 4px;
|
|
792
|
-
width: 10px;
|
|
793
|
-
height: 10px;
|
|
794
|
-
border-radius: 2px;
|
|
790
|
+
const ColorBox = styled.div `
|
|
791
|
+
margin-right: 4px;
|
|
792
|
+
width: 10px;
|
|
793
|
+
height: 10px;
|
|
794
|
+
border-radius: 2px;
|
|
795
795
|
`;
|
|
796
|
-
const ColorLine = styled(ColorBox) `
|
|
797
|
-
height: 2px;
|
|
798
|
-
border-radius: 0;
|
|
796
|
+
const ColorLine = styled(ColorBox) `
|
|
797
|
+
height: 2px;
|
|
798
|
+
border-radius: 0;
|
|
799
799
|
`;
|
|
800
|
-
const Name = styled.div `
|
|
801
|
-
margin-right: 4px;
|
|
800
|
+
const Name = styled.div `
|
|
801
|
+
margin-right: 4px;
|
|
802
802
|
`;
|
|
803
|
-
const Value = styled.div `
|
|
804
|
-
text-align: right;
|
|
805
|
-
flex-shrink: 0;
|
|
806
|
-
flex-grow: 1;
|
|
803
|
+
const Value = styled.div `
|
|
804
|
+
text-align: right;
|
|
805
|
+
flex-shrink: 0;
|
|
806
|
+
flex-grow: 1;
|
|
807
807
|
`;
|
|
808
|
-
const Label$1 = styled.div `
|
|
809
|
-
position: relative;
|
|
810
|
-
font-size: 11px;
|
|
811
|
-
color: #fff;
|
|
812
|
-
font-weight: bold;
|
|
813
|
-
letter-spacing: 0.52px;
|
|
808
|
+
const Label$1 = styled.div `
|
|
809
|
+
position: relative;
|
|
810
|
+
font-size: 11px;
|
|
811
|
+
color: #fff;
|
|
812
|
+
font-weight: bold;
|
|
813
|
+
letter-spacing: 0.52px;
|
|
814
814
|
`;
|
|
815
|
-
const LabelTop = styled(Label$1) `
|
|
816
|
-
top: 6px;
|
|
815
|
+
const LabelTop = styled(Label$1) `
|
|
816
|
+
top: 6px;
|
|
817
817
|
`;
|
|
818
|
-
const LabelBottom = styled(Label$1) `
|
|
819
|
-
bottom: 6px;
|
|
818
|
+
const LabelBottom = styled(Label$1) `
|
|
819
|
+
bottom: 6px;
|
|
820
820
|
`;
|
|
821
821
|
|
|
822
822
|
const drawTooltip$3 = ({ fullChartTooltip, global, tooltipRoot, data, tooltipClassName, tooltipBind, renderTooltip, arc, allSlices, tooltipStyle, width, height, radius, }) => {
|
|
@@ -900,8 +900,15 @@ const drawTooltip$3 = ({ fullChartTooltip, global, tooltipRoot, data, tooltipCla
|
|
|
900
900
|
}
|
|
901
901
|
};
|
|
902
902
|
|
|
903
|
+
const getSliceKey = (item, index) => {
|
|
904
|
+
if (item.id !== undefined)
|
|
905
|
+
return String(item.id);
|
|
906
|
+
if (typeof item.name === 'string' || typeof item.name === 'number')
|
|
907
|
+
return String(item.name);
|
|
908
|
+
return String(index);
|
|
909
|
+
};
|
|
903
910
|
const draw$4 = (node, props) => {
|
|
904
|
-
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;
|
|
911
|
+
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;
|
|
905
912
|
if (node !== null && data.length) {
|
|
906
913
|
const marginTop = margin ? margin.top : 0;
|
|
907
914
|
const marginRight = margin ? margin.right : 0;
|
|
@@ -917,6 +924,18 @@ const draw$4 = (node, props) => {
|
|
|
917
924
|
? marginTop + marginBottom
|
|
918
925
|
: marginRight + marginLeft)) /
|
|
919
926
|
2;
|
|
927
|
+
const prevArcMap = new Map();
|
|
928
|
+
if (transitionDuration > 0) {
|
|
929
|
+
d3.select(node)
|
|
930
|
+
.selectAll(`svg .${pieChartclassNames.pieGlobal} .${pieChartclassNames.pieSlice}`)
|
|
931
|
+
.each((d) => {
|
|
932
|
+
prevArcMap.set(getSliceKey(d.data, d.index), {
|
|
933
|
+
startAngle: d.startAngle,
|
|
934
|
+
endAngle: d.endAngle,
|
|
935
|
+
color: d.data.color ?? '',
|
|
936
|
+
});
|
|
937
|
+
});
|
|
938
|
+
}
|
|
920
939
|
const svg = appendSvg(node, width, height);
|
|
921
940
|
const global = svg
|
|
922
941
|
.append("g")
|
|
@@ -961,17 +980,14 @@ const draw$4 = (node, props) => {
|
|
|
961
980
|
.data(dataReady)
|
|
962
981
|
.enter()
|
|
963
982
|
.append("path")
|
|
964
|
-
// @ts-ignore
|
|
965
|
-
.attr("d", arc);
|
|
966
|
-
allSlices
|
|
967
983
|
.attr("class", pieChartclassNames.pieSlice)
|
|
968
|
-
.attr("fill", ({ index }) => data[index].color || "")
|
|
969
984
|
.attr("stroke", borderColor || "")
|
|
970
985
|
.attr("stroke-width", borderWidth || 0)
|
|
971
986
|
.attr("style", onClick ? "cursor: pointer" : "")
|
|
972
987
|
.on("click",
|
|
973
988
|
// @ts-ignore
|
|
974
|
-
(_, d) => onClick && onClick(data[d.index]))
|
|
989
|
+
(_, d) => onClick && onClick(data[d.index]));
|
|
990
|
+
allSlices
|
|
975
991
|
.append("svg:title")
|
|
976
992
|
.text(d => formatSliceTitle
|
|
977
993
|
? // @ts-ignore
|
|
@@ -979,6 +995,46 @@ const draw$4 = (node, props) => {
|
|
|
979
995
|
: fullChartTooltip || withTooltip
|
|
980
996
|
? ""
|
|
981
997
|
: `${data[d.index].name || ""} (${format(data[d.index].value)})`);
|
|
998
|
+
if (transitionDuration > 0 && prevArcMap.size > 0) {
|
|
999
|
+
allSlices
|
|
1000
|
+
.attr("fill", (d) => {
|
|
1001
|
+
const prev = prevArcMap.get(getSliceKey(d.data, d.index));
|
|
1002
|
+
return prev?.color || data[d.index].color || "";
|
|
1003
|
+
})
|
|
1004
|
+
.attr("d", (d) => {
|
|
1005
|
+
const prev = prevArcMap.get(getSliceKey(d.data, d.index));
|
|
1006
|
+
const midAngle = (d.startAngle + d.endAngle) / 2;
|
|
1007
|
+
// @ts-ignore
|
|
1008
|
+
return arc({
|
|
1009
|
+
...d,
|
|
1010
|
+
startAngle: prev ? prev.startAngle : midAngle,
|
|
1011
|
+
endAngle: prev ? prev.endAngle : midAngle,
|
|
1012
|
+
});
|
|
1013
|
+
})
|
|
1014
|
+
.transition()
|
|
1015
|
+
.duration(transitionDuration)
|
|
1016
|
+
.attr("fill", ({ index }) => data[index].color || "")
|
|
1017
|
+
.attrTween("d", (d) => {
|
|
1018
|
+
const prev = prevArcMap.get(getSliceKey(d.data, d.index));
|
|
1019
|
+
const midAngle = (d.startAngle + d.endAngle) / 2;
|
|
1020
|
+
const from = {
|
|
1021
|
+
startAngle: prev ? prev.startAngle : midAngle,
|
|
1022
|
+
endAngle: prev ? prev.endAngle : midAngle,
|
|
1023
|
+
};
|
|
1024
|
+
const interp = d3.interpolate(from, { startAngle: d.startAngle, endAngle: d.endAngle });
|
|
1025
|
+
return (t) => {
|
|
1026
|
+
const { startAngle, endAngle } = interp(t);
|
|
1027
|
+
// @ts-ignore
|
|
1028
|
+
return arc({ ...d, startAngle, endAngle });
|
|
1029
|
+
};
|
|
1030
|
+
});
|
|
1031
|
+
}
|
|
1032
|
+
else {
|
|
1033
|
+
allSlices
|
|
1034
|
+
// @ts-ignore
|
|
1035
|
+
.attr("d", arc)
|
|
1036
|
+
.attr("fill", ({ index }) => data[index].color || "");
|
|
1037
|
+
}
|
|
982
1038
|
if (enableSlicesLabels) {
|
|
983
1039
|
const text = global
|
|
984
1040
|
.selectAll("allSlices")
|
|
@@ -1205,53 +1261,53 @@ const calendarChartClassNames = {
|
|
|
1205
1261
|
...legendClassNames,
|
|
1206
1262
|
};
|
|
1207
1263
|
const headerHeight = "20px";
|
|
1208
|
-
const SvgWrapper$3 = styled(Wrapper) `
|
|
1209
|
-
.${calendarChartClassNames.calendarYear} {
|
|
1210
|
-
display: flex;
|
|
1211
|
-
margin-bottom: 16px;
|
|
1212
|
-
}
|
|
1213
|
-
|
|
1214
|
-
.${calendarChartClassNames.calendarYearTitle} {
|
|
1215
|
-
display: inline-flex;
|
|
1216
|
-
align-items: flex-end;
|
|
1217
|
-
height: ${headerHeight};
|
|
1218
|
-
margin-bottom: 4px;
|
|
1219
|
-
font-weight: bold;
|
|
1220
|
-
}
|
|
1221
|
-
|
|
1222
|
-
.${calendarChartClassNames.calendarHeader} {
|
|
1223
|
-
height: ${headerHeight};
|
|
1224
|
-
margin-bottom: 4px;
|
|
1225
|
-
position: relative;
|
|
1226
|
-
display: flex;
|
|
1227
|
-
}
|
|
1228
|
-
|
|
1229
|
-
.${calendarChartClassNames.calendarMonth} {
|
|
1230
|
-
font-size: 14px;
|
|
1231
|
-
bottom: 0;
|
|
1232
|
-
position: absolute;
|
|
1233
|
-
}
|
|
1234
|
-
|
|
1235
|
-
.${calendarChartClassNames.calendarAxis} {
|
|
1236
|
-
display: flex;
|
|
1237
|
-
flex-direction: column;
|
|
1238
|
-
margin-right: 10px;
|
|
1239
|
-
}
|
|
1240
|
-
|
|
1241
|
-
.${calendarChartClassNames.calendarWeekDay} {
|
|
1242
|
-
font-size: 12px;
|
|
1243
|
-
display: inline-flex;
|
|
1244
|
-
align-items: center;
|
|
1245
|
-
justify-content: flex-end;
|
|
1246
|
-
}
|
|
1247
|
-
|
|
1248
|
-
.${calendarChartClassNames.calendarDays} {
|
|
1249
|
-
position: relative;
|
|
1250
|
-
}
|
|
1251
|
-
|
|
1252
|
-
.${calendarChartClassNames.calendarDay} {
|
|
1253
|
-
position: absolute;
|
|
1254
|
-
}
|
|
1264
|
+
const SvgWrapper$3 = styled(Wrapper) `
|
|
1265
|
+
.${calendarChartClassNames.calendarYear} {
|
|
1266
|
+
display: flex;
|
|
1267
|
+
margin-bottom: 16px;
|
|
1268
|
+
}
|
|
1269
|
+
|
|
1270
|
+
.${calendarChartClassNames.calendarYearTitle} {
|
|
1271
|
+
display: inline-flex;
|
|
1272
|
+
align-items: flex-end;
|
|
1273
|
+
height: ${headerHeight};
|
|
1274
|
+
margin-bottom: 4px;
|
|
1275
|
+
font-weight: bold;
|
|
1276
|
+
}
|
|
1277
|
+
|
|
1278
|
+
.${calendarChartClassNames.calendarHeader} {
|
|
1279
|
+
height: ${headerHeight};
|
|
1280
|
+
margin-bottom: 4px;
|
|
1281
|
+
position: relative;
|
|
1282
|
+
display: flex;
|
|
1283
|
+
}
|
|
1284
|
+
|
|
1285
|
+
.${calendarChartClassNames.calendarMonth} {
|
|
1286
|
+
font-size: 14px;
|
|
1287
|
+
bottom: 0;
|
|
1288
|
+
position: absolute;
|
|
1289
|
+
}
|
|
1290
|
+
|
|
1291
|
+
.${calendarChartClassNames.calendarAxis} {
|
|
1292
|
+
display: flex;
|
|
1293
|
+
flex-direction: column;
|
|
1294
|
+
margin-right: 10px;
|
|
1295
|
+
}
|
|
1296
|
+
|
|
1297
|
+
.${calendarChartClassNames.calendarWeekDay} {
|
|
1298
|
+
font-size: 12px;
|
|
1299
|
+
display: inline-flex;
|
|
1300
|
+
align-items: center;
|
|
1301
|
+
justify-content: flex-end;
|
|
1302
|
+
}
|
|
1303
|
+
|
|
1304
|
+
.${calendarChartClassNames.calendarDays} {
|
|
1305
|
+
position: relative;
|
|
1306
|
+
}
|
|
1307
|
+
|
|
1308
|
+
.${calendarChartClassNames.calendarDay} {
|
|
1309
|
+
position: absolute;
|
|
1310
|
+
}
|
|
1255
1311
|
`;
|
|
1256
1312
|
|
|
1257
1313
|
const draw$3 = (node, props) => {
|
|
@@ -1478,67 +1534,67 @@ const lineChartClassNames = {
|
|
|
1478
1534
|
lineChartMouseLabelContainer: "lineChartMouseLabelContainer",
|
|
1479
1535
|
lineChartMouseLabel: "lineChartMouseLabel",
|
|
1480
1536
|
};
|
|
1481
|
-
const SvgWrapper$2 = styled(Wrapper) `
|
|
1482
|
-
.${lineChartClassNames.lineChartYScaleGlobal},
|
|
1483
|
-
.${lineChartClassNames.lineChartXScaleGlobal},
|
|
1484
|
-
.${lineChartClassNames.lineChartGridGlobal} {
|
|
1485
|
-
shape-rendering: crispEdges;
|
|
1486
|
-
}
|
|
1487
|
-
|
|
1488
|
-
.${lineChartClassNames.lineChartLinesGlobal} {
|
|
1489
|
-
fill: none;
|
|
1490
|
-
stroke: steelblue;
|
|
1491
|
-
stroke-width: 1.5px;
|
|
1492
|
-
stroke-linejoin: round;
|
|
1493
|
-
stroke-linecap: round;
|
|
1494
|
-
}
|
|
1495
|
-
|
|
1496
|
-
.${lineChartClassNames.lineChartArea} {
|
|
1497
|
-
fill-opacity: 0.24;
|
|
1498
|
-
}
|
|
1499
|
-
|
|
1500
|
-
.${lineChartClassNames.lineChartGridLineX},
|
|
1501
|
-
.${lineChartClassNames.lineChartGridLineY},
|
|
1502
|
-
.${lineChartClassNames.lineChartMouseLine} {
|
|
1503
|
-
stroke: rgba(149, 149, 149, 0.24);
|
|
1504
|
-
}
|
|
1505
|
-
|
|
1506
|
-
.${lineChartClassNames.lineChartMouseLine},
|
|
1507
|
-
.${lineChartClassNames.lineChartMouseCircle} {
|
|
1508
|
-
transition: opacity linear 200ms;
|
|
1509
|
-
pointer-events: none;
|
|
1510
|
-
stroke-width: 1px;
|
|
1511
|
-
}
|
|
1512
|
-
|
|
1513
|
-
.${lineChartClassNames.lineChartDot} {
|
|
1514
|
-
stroke: #fff;
|
|
1515
|
-
stroke-width: 2px;
|
|
1516
|
-
}
|
|
1517
|
-
|
|
1518
|
-
.${lineChartClassNames.lineChartMouseLine} {
|
|
1519
|
-
shape-rendering: crispEdges;
|
|
1520
|
-
}
|
|
1521
|
-
|
|
1522
|
-
.${lineChartClassNames.lineChartMouseRect} {
|
|
1523
|
-
fill: none;
|
|
1524
|
-
pointer-events: all;
|
|
1525
|
-
}
|
|
1537
|
+
const SvgWrapper$2 = styled(Wrapper) `
|
|
1538
|
+
.${lineChartClassNames.lineChartYScaleGlobal},
|
|
1539
|
+
.${lineChartClassNames.lineChartXScaleGlobal},
|
|
1540
|
+
.${lineChartClassNames.lineChartGridGlobal} {
|
|
1541
|
+
shape-rendering: crispEdges;
|
|
1542
|
+
}
|
|
1543
|
+
|
|
1544
|
+
.${lineChartClassNames.lineChartLinesGlobal} {
|
|
1545
|
+
fill: none;
|
|
1546
|
+
stroke: steelblue;
|
|
1547
|
+
stroke-width: 1.5px;
|
|
1548
|
+
stroke-linejoin: round;
|
|
1549
|
+
stroke-linecap: round;
|
|
1550
|
+
}
|
|
1551
|
+
|
|
1552
|
+
.${lineChartClassNames.lineChartArea} {
|
|
1553
|
+
fill-opacity: 0.24;
|
|
1554
|
+
}
|
|
1555
|
+
|
|
1556
|
+
.${lineChartClassNames.lineChartGridLineX},
|
|
1557
|
+
.${lineChartClassNames.lineChartGridLineY},
|
|
1558
|
+
.${lineChartClassNames.lineChartMouseLine} {
|
|
1559
|
+
stroke: rgba(149, 149, 149, 0.24);
|
|
1560
|
+
}
|
|
1561
|
+
|
|
1562
|
+
.${lineChartClassNames.lineChartMouseLine},
|
|
1563
|
+
.${lineChartClassNames.lineChartMouseCircle} {
|
|
1564
|
+
transition: opacity linear 200ms;
|
|
1565
|
+
pointer-events: none;
|
|
1566
|
+
stroke-width: 1px;
|
|
1567
|
+
}
|
|
1568
|
+
|
|
1569
|
+
.${lineChartClassNames.lineChartDot} {
|
|
1570
|
+
stroke: #fff;
|
|
1571
|
+
stroke-width: 2px;
|
|
1572
|
+
}
|
|
1573
|
+
|
|
1574
|
+
.${lineChartClassNames.lineChartMouseLine} {
|
|
1575
|
+
shape-rendering: crispEdges;
|
|
1576
|
+
}
|
|
1577
|
+
|
|
1578
|
+
.${lineChartClassNames.lineChartMouseRect} {
|
|
1579
|
+
fill: none;
|
|
1580
|
+
pointer-events: all;
|
|
1581
|
+
}
|
|
1526
1582
|
`;
|
|
1527
|
-
const TooltipStyles$2 = createGlobalStyle `
|
|
1528
|
-
.${lineChartClassNames.lineChartMouseLabel} {
|
|
1529
|
-
transition: opacity linear 200ms;
|
|
1530
|
-
z-index: 100;
|
|
1531
|
-
|
|
1532
|
-
.${lineChartClassNames.lineChartLabelFlex} {
|
|
1533
|
-
justify-content: flex-start;
|
|
1534
|
-
align-items: center;
|
|
1535
|
-
pointer-events: none;
|
|
1536
|
-
}
|
|
1537
|
-
|
|
1538
|
-
.${lineChartClassNames.lineChartLabel} {
|
|
1539
|
-
margin: 0 0 0 10px;
|
|
1540
|
-
}
|
|
1541
|
-
}
|
|
1583
|
+
const TooltipStyles$2 = createGlobalStyle `
|
|
1584
|
+
.${lineChartClassNames.lineChartMouseLabel} {
|
|
1585
|
+
transition: opacity linear 200ms;
|
|
1586
|
+
z-index: 100;
|
|
1587
|
+
|
|
1588
|
+
.${lineChartClassNames.lineChartLabelFlex} {
|
|
1589
|
+
justify-content: flex-start;
|
|
1590
|
+
align-items: center;
|
|
1591
|
+
pointer-events: none;
|
|
1592
|
+
}
|
|
1593
|
+
|
|
1594
|
+
.${lineChartClassNames.lineChartLabel} {
|
|
1595
|
+
margin: 0 0 0 10px;
|
|
1596
|
+
}
|
|
1597
|
+
}
|
|
1542
1598
|
`;
|
|
1543
1599
|
|
|
1544
1600
|
const drawGrid$2 = ({ svg, yScale, xScale, yTicksCount, lastIndex, drawGridX, drawGridY, }) => {
|
|
@@ -1574,17 +1630,17 @@ const drawGrid$2 = ({ svg, yScale, xScale, yTicksCount, lastIndex, drawGridX, dr
|
|
|
1574
1630
|
}
|
|
1575
1631
|
};
|
|
1576
1632
|
|
|
1577
|
-
const LabelContainer = styled.div `
|
|
1578
|
-
width: 0;
|
|
1579
|
-
height: 0;
|
|
1580
|
-
display: flex;
|
|
1581
|
-
align-items: flex-end;
|
|
1582
|
-
justify-content: center;
|
|
1583
|
-
font-size: 12px;
|
|
1584
|
-
white-space: nowrap;
|
|
1633
|
+
const LabelContainer = styled.div `
|
|
1634
|
+
width: 0;
|
|
1635
|
+
height: 0;
|
|
1636
|
+
display: flex;
|
|
1637
|
+
align-items: flex-end;
|
|
1638
|
+
justify-content: center;
|
|
1639
|
+
font-size: 12px;
|
|
1640
|
+
white-space: nowrap;
|
|
1585
1641
|
`;
|
|
1586
|
-
const Label = styled.div `
|
|
1587
|
-
margin-bottom: 4px;
|
|
1642
|
+
const Label = styled.div `
|
|
1643
|
+
margin-bottom: 4px;
|
|
1588
1644
|
`;
|
|
1589
1645
|
|
|
1590
1646
|
const labelClassName = "d3-chart-label";
|
|
@@ -1827,7 +1883,7 @@ const drawTooltip$2 = ({ svg, node, data: argData, xScale, yScale, dynamicCircle
|
|
|
1827
1883
|
};
|
|
1828
1884
|
|
|
1829
1885
|
const draw$2 = (node, props) => {
|
|
1830
|
-
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;
|
|
1886
|
+
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;
|
|
1831
1887
|
if (node !== null && chartData.length) {
|
|
1832
1888
|
const data = stacked ? stackedData(chartData) : chartData;
|
|
1833
1889
|
const marginTop = margin ? margin.top : 0;
|
|
@@ -1843,6 +1899,14 @@ const draw$2 = (node, props) => {
|
|
|
1843
1899
|
const max = typeof props.max === 'number'
|
|
1844
1900
|
? props.max
|
|
1845
1901
|
: d3.max(data, ({ values }) => d3.max(values));
|
|
1902
|
+
const prevStrokes = new Map();
|
|
1903
|
+
if (transitionDuration > 0) {
|
|
1904
|
+
d3.select(node)
|
|
1905
|
+
.selectAll(`svg .${lineChartClassNames.lineChartLinesGlobal} .${lineChartClassNames.lineChartLine}`)
|
|
1906
|
+
.each(function (_, i) {
|
|
1907
|
+
prevStrokes.set(i, d3.select(this).attr('stroke') || '');
|
|
1908
|
+
});
|
|
1909
|
+
}
|
|
1846
1910
|
const svg = appendSvg(node, width, height || 0);
|
|
1847
1911
|
const yRange = [
|
|
1848
1912
|
height - marginTop - marginBottom - (xAxisPadding || 0),
|
|
@@ -1981,7 +2045,7 @@ const draw$2 = (node, props) => {
|
|
|
1981
2045
|
.attr('fill', ({ fill }) => fill || 'none')
|
|
1982
2046
|
.attr('style', ({ areaStyle }) => areaStyle || '');
|
|
1983
2047
|
}
|
|
1984
|
-
svg
|
|
2048
|
+
const lineSelection = svg
|
|
1985
2049
|
.append('g')
|
|
1986
2050
|
.attr('class', lineChartClassNames.lineChartLinesGlobal)
|
|
1987
2051
|
.selectAll('path')
|
|
@@ -1989,8 +2053,17 @@ const draw$2 = (node, props) => {
|
|
|
1989
2053
|
.join('path')
|
|
1990
2054
|
.attr('class', lineChartClassNames.lineChartLine)
|
|
1991
2055
|
.attr('d', (d) => line(d.values))
|
|
1992
|
-
.attr('stroke', ({ stroke }) => stroke || 'steelblue')
|
|
1993
2056
|
.attr('style', ({ style }) => style || '');
|
|
2057
|
+
if (transitionDuration > 0 && prevStrokes.size > 0) {
|
|
2058
|
+
lineSelection
|
|
2059
|
+
.attr('stroke', (_, i) => prevStrokes.get(i) || (data[i]?.stroke || 'steelblue'))
|
|
2060
|
+
.transition()
|
|
2061
|
+
.duration(transitionDuration)
|
|
2062
|
+
.attr('stroke', ({ stroke }) => stroke || 'steelblue');
|
|
2063
|
+
}
|
|
2064
|
+
else {
|
|
2065
|
+
lineSelection.attr('stroke', ({ stroke }) => stroke || 'steelblue');
|
|
2066
|
+
}
|
|
1994
2067
|
const dots = data.filter(({ dot }) => dot);
|
|
1995
2068
|
if (dots.length > 0) {
|
|
1996
2069
|
const dotsGlobal = svg
|
|
@@ -2178,66 +2251,66 @@ const barChartClassNames = {
|
|
|
2178
2251
|
...labelClassnames,
|
|
2179
2252
|
...barChartLinesClassNames,
|
|
2180
2253
|
};
|
|
2181
|
-
const SvgWrapper$1 = styled(Wrapper) `
|
|
2182
|
-
display: ${({ selectable }) => selectable && "inline-block"};
|
|
2183
|
-
user-select: ${({ selectable }) => selectable && "none"};
|
|
2184
|
-
width: ${({ selectable }) => selectable && "auto"};
|
|
2185
|
-
|
|
2186
|
-
line {
|
|
2187
|
-
stroke-width: 1px;
|
|
2188
|
-
shape-rendering: crispEdges;
|
|
2189
|
-
}
|
|
2190
|
-
|
|
2191
|
-
.${barChartClassNames.barChartGridLineX},
|
|
2192
|
-
.${barChartClassNames.barChartGridLineY} {
|
|
2193
|
-
stroke: rgba(48, 69, 79, 0.06);
|
|
2194
|
-
}
|
|
2195
|
-
|
|
2196
|
-
.${barChartClassNames.barChartMouseRect} {
|
|
2197
|
-
}
|
|
2198
|
-
|
|
2199
|
-
.${barChartClassNames.barChartMouseRect} {
|
|
2200
|
-
fill: none;
|
|
2201
|
-
pointer-events: all;
|
|
2202
|
-
}
|
|
2203
|
-
|
|
2204
|
-
.${barChartClassNames.barChartLinesGlobal} {
|
|
2205
|
-
stroke-width: 1.5px;
|
|
2206
|
-
stroke-linejoin: round;
|
|
2207
|
-
stroke-linecap: round;
|
|
2208
|
-
}
|
|
2209
|
-
|
|
2210
|
-
.${barChartClassNames.barChartLine} {
|
|
2211
|
-
shape-rendering: auto;
|
|
2212
|
-
}
|
|
2213
|
-
|
|
2214
|
-
.${barChartClassNames.barChartArea} {
|
|
2215
|
-
fill-opacity: 0.24;
|
|
2216
|
-
}
|
|
2217
|
-
|
|
2218
|
-
.${barChartClassNames.barChartSelection} {
|
|
2219
|
-
position: absolute;
|
|
2220
|
-
top: 0;
|
|
2221
|
-
width: 0;
|
|
2222
|
-
background: rgba(0, 170, 255, 0.06);
|
|
2223
|
-
box-shadow: 1px 0 0 #00AAFF, -1px 0 0 #00AAFF;
|
|
2224
|
-
pointer-events: none;
|
|
2225
|
-
}
|
|
2254
|
+
const SvgWrapper$1 = styled(Wrapper) `
|
|
2255
|
+
display: ${({ selectable }) => selectable && "inline-block"};
|
|
2256
|
+
user-select: ${({ selectable }) => selectable && "none"};
|
|
2257
|
+
width: ${({ selectable }) => selectable && "auto"};
|
|
2258
|
+
|
|
2259
|
+
line {
|
|
2260
|
+
stroke-width: 1px;
|
|
2261
|
+
shape-rendering: crispEdges;
|
|
2262
|
+
}
|
|
2263
|
+
|
|
2264
|
+
.${barChartClassNames.barChartGridLineX},
|
|
2265
|
+
.${barChartClassNames.barChartGridLineY} {
|
|
2266
|
+
stroke: rgba(48, 69, 79, 0.06);
|
|
2267
|
+
}
|
|
2268
|
+
|
|
2269
|
+
.${barChartClassNames.barChartMouseRect} {
|
|
2270
|
+
}
|
|
2271
|
+
|
|
2272
|
+
.${barChartClassNames.barChartMouseRect} {
|
|
2273
|
+
fill: none;
|
|
2274
|
+
pointer-events: all;
|
|
2275
|
+
}
|
|
2276
|
+
|
|
2277
|
+
.${barChartClassNames.barChartLinesGlobal} {
|
|
2278
|
+
stroke-width: 1.5px;
|
|
2279
|
+
stroke-linejoin: round;
|
|
2280
|
+
stroke-linecap: round;
|
|
2281
|
+
}
|
|
2282
|
+
|
|
2283
|
+
.${barChartClassNames.barChartLine} {
|
|
2284
|
+
shape-rendering: auto;
|
|
2285
|
+
}
|
|
2286
|
+
|
|
2287
|
+
.${barChartClassNames.barChartArea} {
|
|
2288
|
+
fill-opacity: 0.24;
|
|
2289
|
+
}
|
|
2290
|
+
|
|
2291
|
+
.${barChartClassNames.barChartSelection} {
|
|
2292
|
+
position: absolute;
|
|
2293
|
+
top: 0;
|
|
2294
|
+
width: 0;
|
|
2295
|
+
background: rgba(0, 170, 255, 0.06);
|
|
2296
|
+
box-shadow: 1px 0 0 #00AAFF, -1px 0 0 #00AAFF;
|
|
2297
|
+
pointer-events: none;
|
|
2298
|
+
}
|
|
2226
2299
|
`;
|
|
2227
|
-
const TooltipStyles$1 = createGlobalStyle `
|
|
2228
|
-
.${barChartClassNames.barChartMouseTooltip} {
|
|
2229
|
-
z-index: 100;
|
|
2230
|
-
transition: all linear 144ms;
|
|
2231
|
-
|
|
2232
|
-
.${barChartClassNames.barChartTooltipItem} {
|
|
2233
|
-
padding: 0.125rem;
|
|
2234
|
-
margin-bottom: 4px;
|
|
2235
|
-
|
|
2236
|
-
:last-of-type {
|
|
2237
|
-
margin-bottom: 0;
|
|
2238
|
-
}
|
|
2239
|
-
}
|
|
2240
|
-
}
|
|
2300
|
+
const TooltipStyles$1 = createGlobalStyle `
|
|
2301
|
+
.${barChartClassNames.barChartMouseTooltip} {
|
|
2302
|
+
z-index: 100;
|
|
2303
|
+
transition: all linear 144ms;
|
|
2304
|
+
|
|
2305
|
+
.${barChartClassNames.barChartTooltipItem} {
|
|
2306
|
+
padding: 0.125rem;
|
|
2307
|
+
margin-bottom: 4px;
|
|
2308
|
+
|
|
2309
|
+
:last-of-type {
|
|
2310
|
+
margin-bottom: 0;
|
|
2311
|
+
}
|
|
2312
|
+
}
|
|
2313
|
+
}
|
|
2241
2314
|
`;
|
|
2242
2315
|
|
|
2243
2316
|
const useSelection = (node, props) => {
|
|
@@ -2781,7 +2854,7 @@ const getBars = ({ groups, barWidth }) => {
|
|
|
2781
2854
|
|
|
2782
2855
|
const MIN_BAR_HEIGHT = 2;
|
|
2783
2856
|
const draw$1 = (node, props) => {
|
|
2784
|
-
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;
|
|
2857
|
+
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;
|
|
2785
2858
|
if (node !== null && data.length) {
|
|
2786
2859
|
const marginTop = margin?.top ?? 0;
|
|
2787
2860
|
const marginRight = margin?.right ?? 0;
|
|
@@ -2804,6 +2877,20 @@ const draw$1 = (node, props) => {
|
|
|
2804
2877
|
? maxValue
|
|
2805
2878
|
: Math.max(d3.max(lineData, ({ values }) => d3.max(values)) ||
|
|
2806
2879
|
Number.NEGATIVE_INFINITY, barDomain.max);
|
|
2880
|
+
const prevBarFills = new Map();
|
|
2881
|
+
if (transitionDuration > 0) {
|
|
2882
|
+
d3.select(node)
|
|
2883
|
+
.selectAll(`svg .${barChartClassNames.barChartBarGlobal} g`)
|
|
2884
|
+
.each(function (_, groupIdx) {
|
|
2885
|
+
d3.select(this).selectAll('rect')
|
|
2886
|
+
.each(function (_, rectIdx) {
|
|
2887
|
+
const fill = this.style.fill;
|
|
2888
|
+
if (fill) {
|
|
2889
|
+
prevBarFills.set(`${groupIdx}-${rectIdx}`, fill);
|
|
2890
|
+
}
|
|
2891
|
+
});
|
|
2892
|
+
});
|
|
2893
|
+
}
|
|
2807
2894
|
const svg = appendSvg(node, width, height || 0);
|
|
2808
2895
|
const yTicksCountDefault = 4;
|
|
2809
2896
|
const labels = data.map((item) => item.groupName);
|
|
@@ -2958,6 +3045,24 @@ const draw$1 = (node, props) => {
|
|
|
2958
3045
|
});
|
|
2959
3046
|
}
|
|
2960
3047
|
customize && customize({ svg, marshalledData, yScale, xScale, lineData });
|
|
3048
|
+
if (transitionDuration > 0 && prevBarFills.size > 0) {
|
|
3049
|
+
d3.select(node)
|
|
3050
|
+
.selectAll(`.${barChartClassNames.barChartBarGlobal} g`)
|
|
3051
|
+
.each(function (_, groupIdx) {
|
|
3052
|
+
d3.select(this).selectAll('rect')
|
|
3053
|
+
.each(function (_, rectIdx) {
|
|
3054
|
+
const prevFill = prevBarFills.get(`${groupIdx}-${rectIdx}`);
|
|
3055
|
+
const currentFill = this.style.fill;
|
|
3056
|
+
if (prevFill && prevFill !== currentFill) {
|
|
3057
|
+
d3.select(this)
|
|
3058
|
+
.style('fill', prevFill)
|
|
3059
|
+
.transition()
|
|
3060
|
+
.duration(transitionDuration)
|
|
3061
|
+
.style('fill', currentFill);
|
|
3062
|
+
}
|
|
3063
|
+
});
|
|
3064
|
+
});
|
|
3065
|
+
}
|
|
2961
3066
|
}
|
|
2962
3067
|
};
|
|
2963
3068
|
|
|
@@ -3045,45 +3150,45 @@ const horizontalBarChartClassNames = {
|
|
|
3045
3150
|
horizontalBarChartTooltipName: "horizontalBarChartTooltipName",
|
|
3046
3151
|
horizontalBarChartTooltipValue: "horizontalBarChartTooltipValue",
|
|
3047
3152
|
};
|
|
3048
|
-
const Table = styled.table `
|
|
3049
|
-
width: 100%;
|
|
3153
|
+
const Table = styled.table `
|
|
3154
|
+
width: 100%;
|
|
3050
3155
|
`;
|
|
3051
|
-
const LabelCell = styled.div `
|
|
3052
|
-
text-align: right;
|
|
3156
|
+
const LabelCell = styled.div `
|
|
3157
|
+
text-align: right;
|
|
3053
3158
|
`;
|
|
3054
|
-
const BarFlex = styled.div `
|
|
3055
|
-
width: 100%;
|
|
3056
|
-
display: flex;
|
|
3057
|
-
height: 1rem;
|
|
3159
|
+
const BarFlex = styled.div `
|
|
3160
|
+
width: 100%;
|
|
3161
|
+
display: flex;
|
|
3162
|
+
height: 1rem;
|
|
3058
3163
|
`;
|
|
3059
|
-
const BarsTd = styled.td `
|
|
3060
|
-
width: 100%;
|
|
3061
|
-
position: relative;
|
|
3062
|
-
vertical-align: middle;
|
|
3164
|
+
const BarsTd = styled.td `
|
|
3165
|
+
width: 100%;
|
|
3166
|
+
position: relative;
|
|
3167
|
+
vertical-align: middle;
|
|
3063
3168
|
`;
|
|
3064
|
-
const TooltipFlex = styled(TooltipFlex$1) `
|
|
3065
|
-
position: absolute;
|
|
3066
|
-
top: 0;
|
|
3067
|
-
left: 50%;
|
|
3068
|
-
transform: translate(-50%, -50%);
|
|
3069
|
-
will-change: left, top;
|
|
3169
|
+
const TooltipFlex = styled(TooltipFlex$1) `
|
|
3170
|
+
position: absolute;
|
|
3171
|
+
top: 0;
|
|
3172
|
+
left: 50%;
|
|
3173
|
+
transform: translate(-50%, -50%);
|
|
3174
|
+
will-change: left, top;
|
|
3070
3175
|
`;
|
|
3071
|
-
const StackSumContainer = styled.div `
|
|
3072
|
-
position: relative;
|
|
3176
|
+
const StackSumContainer = styled.div `
|
|
3177
|
+
position: relative;
|
|
3073
3178
|
`;
|
|
3074
|
-
const StackSum = styled.div `
|
|
3075
|
-
white-space: nowrap;
|
|
3076
|
-
position: absolute;
|
|
3077
|
-
top: 50%;
|
|
3078
|
-
left: 50%;
|
|
3079
|
-
transform: translate(0, -50%);
|
|
3179
|
+
const StackSum = styled.div `
|
|
3180
|
+
white-space: nowrap;
|
|
3181
|
+
position: absolute;
|
|
3182
|
+
top: 50%;
|
|
3183
|
+
left: 50%;
|
|
3184
|
+
transform: translate(0, -50%);
|
|
3080
3185
|
`;
|
|
3081
|
-
const StackWrapper = styled.div `
|
|
3082
|
-
position: absolute;
|
|
3083
|
-
top: 0;
|
|
3084
|
-
display: flex;
|
|
3085
|
-
justify-content: flex-start;
|
|
3086
|
-
height: 100%;
|
|
3186
|
+
const StackWrapper = styled.div `
|
|
3187
|
+
position: absolute;
|
|
3188
|
+
top: 0;
|
|
3189
|
+
display: flex;
|
|
3190
|
+
justify-content: flex-start;
|
|
3191
|
+
height: 100%;
|
|
3087
3192
|
`;
|
|
3088
3193
|
|
|
3089
3194
|
const Tooltip$1 = ({ renderTooltip, bars, style, className, }) => {
|
|
@@ -3135,10 +3240,10 @@ const useStackWrapper = (stackedTooltip) => {
|
|
|
3135
3240
|
: ({ children }) => (jsx(Fragment$1, { children: children })), [stackedTooltip]);
|
|
3136
3241
|
};
|
|
3137
3242
|
|
|
3138
|
-
const BarStyled = styled.div `
|
|
3139
|
-
position: relative;
|
|
3140
|
-
display: inline-flex;
|
|
3141
|
-
height: 100%;
|
|
3243
|
+
const BarStyled = styled.div `
|
|
3244
|
+
position: relative;
|
|
3245
|
+
display: inline-flex;
|
|
3246
|
+
height: 100%;
|
|
3142
3247
|
`;
|
|
3143
3248
|
|
|
3144
3249
|
const Bar = ({ withTooltip, bar, formatNativeTitle, tooltipBind, mouseMove, mouseLeave, pointerEventsNone, isFirstChild, isLastChild, isOnlyChild, }) => {
|
|
@@ -3155,23 +3260,23 @@ const Bar = ({ withTooltip, bar, formatNativeTitle, tooltipBind, mouseMove, mous
|
|
|
3155
3260
|
}, title: formatNativeTitle ? formatNativeTitle(bar) : "", onMouseOver: onMouseMove, onMouseMove: tooltipBind ? onMouseMove : void 0, onMouseOut: onMouseLeave }));
|
|
3156
3261
|
};
|
|
3157
3262
|
|
|
3158
|
-
const TickTd = styled.td `
|
|
3159
|
-
position: relative;
|
|
3263
|
+
const TickTd = styled.td `
|
|
3264
|
+
position: relative;
|
|
3160
3265
|
`;
|
|
3161
|
-
const Ticks = styled.div `
|
|
3162
|
-
position: relative;
|
|
3163
|
-
height: 1rem;
|
|
3266
|
+
const Ticks = styled.div `
|
|
3267
|
+
position: relative;
|
|
3268
|
+
height: 1rem;
|
|
3164
3269
|
`;
|
|
3165
|
-
const Tick = styled.div `
|
|
3166
|
-
white-space: nowrap;
|
|
3167
|
-
width: 0;
|
|
3168
|
-
height: 0;
|
|
3169
|
-
position: absolute;
|
|
3170
|
-
top: 50%;
|
|
3171
|
-
transform: translateY(-50%);
|
|
3172
|
-
display: flex;
|
|
3173
|
-
align-items: center;
|
|
3174
|
-
justify-content: center;
|
|
3270
|
+
const Tick = styled.div `
|
|
3271
|
+
white-space: nowrap;
|
|
3272
|
+
width: 0;
|
|
3273
|
+
height: 0;
|
|
3274
|
+
position: absolute;
|
|
3275
|
+
top: 50%;
|
|
3276
|
+
transform: translateY(-50%);
|
|
3277
|
+
display: flex;
|
|
3278
|
+
align-items: center;
|
|
3279
|
+
justify-content: center;
|
|
3175
3280
|
`;
|
|
3176
3281
|
|
|
3177
3282
|
const hundred = 100;
|
|
@@ -3270,29 +3375,29 @@ const bubbleChartClassNames = {
|
|
|
3270
3375
|
bubbleChartTooltipFlex: "bubbleChartTooltipFlex",
|
|
3271
3376
|
bubbleChartTip: "bubbleChartTip",
|
|
3272
3377
|
};
|
|
3273
|
-
const SvgWrapper = styled(Wrapper) `
|
|
3274
|
-
.${bubbleChartClassNames.bubbleChartYAxis},
|
|
3275
|
-
.${bubbleChartClassNames.bubbleChartXAxis},
|
|
3276
|
-
.${bubbleChartClassNames.bubbleChartGridGlobal} {
|
|
3277
|
-
shape-rendering: crispEdges;
|
|
3278
|
-
}
|
|
3279
|
-
|
|
3280
|
-
.${bubbleChartClassNames.bubbleChartGridLineX},
|
|
3281
|
-
.${bubbleChartClassNames.bubbleChartGridLineY} {
|
|
3282
|
-
stroke: rgba(149, 149, 149, 0.24);
|
|
3283
|
-
}
|
|
3284
|
-
|
|
3285
|
-
.${bubbleChartClassNames.bubbleChartYScaleLabel} {
|
|
3286
|
-
font-size: 10px;
|
|
3287
|
-
}
|
|
3378
|
+
const SvgWrapper = styled(Wrapper) `
|
|
3379
|
+
.${bubbleChartClassNames.bubbleChartYAxis},
|
|
3380
|
+
.${bubbleChartClassNames.bubbleChartXAxis},
|
|
3381
|
+
.${bubbleChartClassNames.bubbleChartGridGlobal} {
|
|
3382
|
+
shape-rendering: crispEdges;
|
|
3383
|
+
}
|
|
3384
|
+
|
|
3385
|
+
.${bubbleChartClassNames.bubbleChartGridLineX},
|
|
3386
|
+
.${bubbleChartClassNames.bubbleChartGridLineY} {
|
|
3387
|
+
stroke: rgba(149, 149, 149, 0.24);
|
|
3388
|
+
}
|
|
3389
|
+
|
|
3390
|
+
.${bubbleChartClassNames.bubbleChartYScaleLabel} {
|
|
3391
|
+
font-size: 10px;
|
|
3392
|
+
}
|
|
3288
3393
|
`;
|
|
3289
|
-
const TooltipStyles = createGlobalStyle `
|
|
3290
|
-
.${bubbleChartClassNames.bubbleChartTooltipContainer} {
|
|
3291
|
-
position: absolute;
|
|
3292
|
-
transition: opacity 150ms cubic-bezier(0.2, 1, 0.6, 1);
|
|
3293
|
-
pointer-events: none;
|
|
3294
|
-
z-index: 1;
|
|
3295
|
-
}
|
|
3394
|
+
const TooltipStyles = createGlobalStyle `
|
|
3395
|
+
.${bubbleChartClassNames.bubbleChartTooltipContainer} {
|
|
3396
|
+
position: absolute;
|
|
3397
|
+
transition: opacity 150ms cubic-bezier(0.2, 1, 0.6, 1);
|
|
3398
|
+
pointer-events: none;
|
|
3399
|
+
z-index: 1;
|
|
3400
|
+
}
|
|
3296
3401
|
`;
|
|
3297
3402
|
|
|
3298
3403
|
const drawGrid = ({ svg, yScale, xScale, yTicksCount, drawGridX, drawGridY, }) => {
|
|
@@ -3329,14 +3434,14 @@ const drawGrid = ({ svg, yScale, xScale, yTicksCount, drawGridX, drawGridY, }) =
|
|
|
3329
3434
|
}
|
|
3330
3435
|
};
|
|
3331
3436
|
|
|
3332
|
-
const Tooltip = styled.div `
|
|
3333
|
-
width: 0;
|
|
3334
|
-
height: 0;
|
|
3335
|
-
display: flex;
|
|
3336
|
-
align-items: flex-end;
|
|
3337
|
-
justify-content: center;
|
|
3338
|
-
font-size: 12px;
|
|
3339
|
-
white-space: nowrap;
|
|
3437
|
+
const Tooltip = styled.div `
|
|
3438
|
+
width: 0;
|
|
3439
|
+
height: 0;
|
|
3440
|
+
display: flex;
|
|
3441
|
+
align-items: flex-end;
|
|
3442
|
+
justify-content: center;
|
|
3443
|
+
font-size: 12px;
|
|
3444
|
+
white-space: nowrap;
|
|
3340
3445
|
`;
|
|
3341
3446
|
|
|
3342
3447
|
const drawTooltip = ({ bubbles, tooltipRoot, tooltipClassName, renderTooltip, }) => {
|