@semcore/d3-chart 1.5.2 → 1.5.6
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/CHANGELOG.md +24 -0
- package/lib/cjs/Area.js +15 -13
- package/lib/cjs/Area.js.map +1 -1
- package/lib/cjs/Axis.js +12 -12
- package/lib/cjs/Bar.js +21 -17
- package/lib/cjs/Bar.js.map +1 -1
- package/lib/cjs/Donut.js +77 -64
- package/lib/cjs/Donut.js.map +1 -1
- package/lib/cjs/Dots.js +8 -7
- package/lib/cjs/Dots.js.map +1 -1
- package/lib/cjs/GroupBar.js +8 -7
- package/lib/cjs/GroupBar.js.map +1 -1
- package/lib/cjs/HorizontalBar.js +21 -17
- package/lib/cjs/HorizontalBar.js.map +1 -1
- package/lib/cjs/Hover.js +3 -3
- package/lib/cjs/Line.js +14 -12
- package/lib/cjs/Line.js.map +1 -1
- package/lib/cjs/StackBar.js +39 -14
- package/lib/cjs/StackBar.js.map +1 -1
- package/lib/cjs/StackedArea.js +11 -9
- package/lib/cjs/StackedArea.js.map +1 -1
- package/lib/cjs/Tooltip.js +11 -11
- package/lib/cjs/Tooltip.js.map +1 -1
- package/lib/cjs/Venn.js +8 -8
- package/lib/cjs/Venn.js.map +1 -1
- package/lib/cjs/color.js +32 -30
- package/lib/cjs/color.js.map +1 -1
- package/lib/cjs/style/area.shadow.css +12 -2
- package/lib/cjs/style/bar.shadow.css +7 -2
- package/lib/cjs/style/donut.shadow.css +15 -0
- package/lib/cjs/style/dot.shadow.css +6 -1
- package/lib/cjs/style/line.shadow.css +6 -1
- package/lib/cjs/style/tooltip.shadow.css +5 -0
- package/lib/cjs/style/var.css +32 -0
- package/lib/cjs/style/venn.shadow.css +7 -1
- package/lib/es6/Area.js +15 -13
- package/lib/es6/Area.js.map +1 -1
- package/lib/es6/Axis.js +12 -12
- package/lib/es6/Bar.js +21 -17
- package/lib/es6/Bar.js.map +1 -1
- package/lib/es6/Donut.js +77 -64
- package/lib/es6/Donut.js.map +1 -1
- package/lib/es6/Dots.js +8 -7
- package/lib/es6/Dots.js.map +1 -1
- package/lib/es6/GroupBar.js +8 -7
- package/lib/es6/GroupBar.js.map +1 -1
- package/lib/es6/HorizontalBar.js +21 -17
- package/lib/es6/HorizontalBar.js.map +1 -1
- package/lib/es6/Hover.js +3 -3
- package/lib/es6/Line.js +14 -12
- package/lib/es6/Line.js.map +1 -1
- package/lib/es6/StackBar.js +39 -14
- package/lib/es6/StackBar.js.map +1 -1
- package/lib/es6/StackedArea.js +11 -9
- package/lib/es6/StackedArea.js.map +1 -1
- package/lib/es6/Tooltip.js +10 -10
- package/lib/es6/Tooltip.js.map +1 -1
- package/lib/es6/Venn.js +8 -8
- package/lib/es6/Venn.js.map +1 -1
- package/lib/es6/color.js +33 -31
- package/lib/es6/color.js.map +1 -1
- package/lib/es6/style/area.shadow.css +12 -2
- package/lib/es6/style/bar.shadow.css +7 -2
- package/lib/es6/style/donut.shadow.css +15 -0
- package/lib/es6/style/dot.shadow.css +6 -1
- package/lib/es6/style/line.shadow.css +6 -1
- package/lib/es6/style/tooltip.shadow.css +5 -0
- package/lib/es6/style/var.css +32 -0
- package/lib/es6/style/venn.shadow.css +7 -1
- package/lib/types/Bar.d.ts +1 -1
- package/lib/types/HorizontalBar.d.ts +1 -1
- package/package.json +1 -1
- package/src/Area.js +2 -3
- package/src/Bar.js +13 -10
- package/src/Donut.js +8 -7
- package/src/GroupBar.js +6 -2
- package/src/HorizontalBar.js +14 -10
- package/src/Line.js +2 -3
- package/src/StackBar.js +24 -7
- package/src/StackedArea.js +3 -2
- package/src/Tooltip.js +2 -2
- package/src/Venn.js +1 -1
- package/src/color.js +6 -32
- package/src/style/area.shadow.css +12 -2
- package/src/style/bar.shadow.css +7 -2
- package/src/style/donut.shadow.css +15 -0
- package/src/style/dot.shadow.css +6 -1
- package/src/style/line.shadow.css +6 -1
- package/src/style/tooltip.shadow.css +5 -0
- package/src/style/var.css +32 -0
- package/src/style/venn.shadow.css +7 -1
- package/src/types/Bar.d.ts +1 -1
- package/src/types/HorizontalBar.d.ts +1 -1
package/lib/es6/color.js
CHANGED
|
@@ -1,40 +1,42 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
1
|
+
/*__semcore-vars__:"./style/var.css"*/
|
|
2
|
+
var colors = {
|
|
3
|
+
"blue-01": "#50aef4",
|
|
4
|
+
"blue-02": "#91c7ef",
|
|
5
|
+
"blue-03": "#0e75c2",
|
|
6
|
+
"blue-04": "#d1e8f8",
|
|
7
|
+
"blue-05": "#084c80",
|
|
8
|
+
"green-01": "#3ab011",
|
|
9
|
+
"green-02": "#91d27b",
|
|
10
|
+
"green-03": "#278707",
|
|
11
|
+
"green-04": "#d1edc8",
|
|
12
|
+
"green-05": "#1a6700",
|
|
13
|
+
"orange-01": "#ff8e29",
|
|
14
|
+
"orange-02": "#fec089",
|
|
15
|
+
"orange-03": "#da6905",
|
|
16
|
+
"orange-04": "#ffe5cd",
|
|
17
|
+
"orange-05": "#a14e03",
|
|
18
|
+
"violet-01": "#890c85",
|
|
19
|
+
"violet-02": "#c783c5",
|
|
20
|
+
"violet-03": "#6e026b",
|
|
21
|
+
"violet-04": "#e7cbe6",
|
|
22
|
+
"violet-05": "#4d024b",
|
|
23
|
+
"red-01": "#e91e25",
|
|
24
|
+
"red-02": "#f69498",
|
|
25
|
+
"red-03": "#bd0000",
|
|
26
|
+
"red-04": "#fbd2d3",
|
|
27
|
+
"red-05": "#830005",
|
|
28
|
+
"yellow-01": "#ffc83f",
|
|
29
|
+
"yellow-02": "#ffdb82",
|
|
30
|
+
"yellow-03": "#e4aa18",
|
|
31
|
+
"yellow-04": "#ffebb9",
|
|
32
|
+
"yellow-05": "#b3840c"
|
|
32
33
|
};
|
|
33
34
|
var componentRenderIndex = 0;
|
|
34
35
|
var cache = {};
|
|
35
36
|
var colorValues = Object.keys(colors).sort(function (a, b) {
|
|
36
37
|
return parseInt(a.match(/[0-9]/g).join(''), 10) - parseInt(b.match(/[0-9]/g).join(''), 10);
|
|
37
38
|
});
|
|
39
|
+
export { colors };
|
|
38
40
|
export default function getColor(key) {
|
|
39
41
|
if (cache[key]) {
|
|
40
42
|
return cache[key];
|
package/lib/es6/color.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/color.js"],"names":["colors","componentRenderIndex","cache","colorValues","Object","keys","sort","a","b","parseInt","match","join","getColor","key","color"],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"sources":["../../src/color.js"],"names":["colors","componentRenderIndex","cache","colorValues","Object","keys","sort","a","b","parseInt","match","join","getColor","key","color"],"mappings":"AAAA;AACA,IAAMA,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAZ;AAKA,IAAIC,oBAAoB,GAAG,CAA3B;AACA,IAAMC,KAAK,GAAG,EAAd;AACA,IAAMC,WAAW,GAAGC,MAAM,CAACC,IAAP,CAAYL,MAAZ,EAAoBM,IAApB,CAAyB,UAACC,CAAD,EAAIC,CAAJ,EAAU;AACrD,SAAOC,QAAQ,CAACF,CAAC,CAACG,KAAF,CAAQ,QAAR,EAAkBC,IAAlB,CAAuB,EAAvB,CAAD,EAA6B,EAA7B,CAAR,GAA2CF,QAAQ,CAACD,CAAC,CAACE,KAAF,CAAQ,QAAR,EAAkBC,IAAlB,CAAuB,EAAvB,CAAD,EAA6B,EAA7B,CAA1D;AACD,CAFmB,CAApB;AAIA,SAASX,MAAT;AACA,eAAe,SAASY,QAAT,CAAkBC,GAAlB,EAAuB;AACpC,MAAIX,KAAK,CAACW,GAAD,CAAT,EAAgB;AACd,WAAOX,KAAK,CAACW,GAAD,CAAZ;AACD;;AACD,MAAMC,KAAK,GAAGd,MAAM,CAACG,WAAW,CAACF,oBAAoB,EAArB,CAAZ,CAApB;AACAC,EAAAA,KAAK,CAACW,GAAD,CAAL,GAAaC,KAAb;AACA,SAAOA,KAAP;AACD","sourcesContent":["/*__semcore-vars__:\"./style/var.css\"*/\nconst colors = preval`\n const path = require('path');\n module.exports = require('@semcore/babel-plugin-react-semcore/utils/vars')(path.resolve(__dirname, './style/var.css'));\n`;\n\nlet componentRenderIndex = 0;\nconst cache = {};\nconst colorValues = Object.keys(colors).sort((a, b) => {\n return parseInt(a.match(/[0-9]/g).join(''), 10) - parseInt(b.match(/[0-9]/g).join(''), 10);\n});\n\nexport { colors };\nexport default function getColor(key) {\n if (cache[key]) {\n return cache[key];\n }\n const color = colors[colorValues[componentRenderIndex++]];\n cache[key] = color;\n return color;\n}\n"],"file":"color.js"}
|
|
@@ -1,14 +1,24 @@
|
|
|
1
|
+
@import '@semcore/d3-chart/src/style/var.css';
|
|
2
|
+
|
|
1
3
|
SArea {
|
|
2
|
-
fill: var(--
|
|
4
|
+
fill: var(--blue-01);
|
|
3
5
|
fill-opacity: 0.4;
|
|
4
6
|
}
|
|
5
7
|
|
|
8
|
+
SArea[color] {
|
|
9
|
+
fill: var(--color);
|
|
10
|
+
}
|
|
11
|
+
|
|
6
12
|
SAreaLine {
|
|
7
|
-
stroke: var(--
|
|
13
|
+
stroke: var(--blue-01);
|
|
8
14
|
stroke-width: 3;
|
|
9
15
|
fill: transparent;
|
|
10
16
|
}
|
|
11
17
|
|
|
18
|
+
SAreaLine[color] {
|
|
19
|
+
stroke: var(--color);
|
|
20
|
+
}
|
|
21
|
+
|
|
12
22
|
SArea,
|
|
13
23
|
SAreaLine {
|
|
14
24
|
transition-property: d;
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
@import '@semcore/utils/style/var.css';
|
|
2
|
+
@import '@semcore/d3-chart/src/style/var.css';
|
|
2
3
|
|
|
3
4
|
SBar {
|
|
4
|
-
fill: var(--
|
|
5
|
+
fill: var(--blue-01);
|
|
5
6
|
transition-property: height, width, y;
|
|
6
7
|
transition-duration: var(--duration);
|
|
7
8
|
transition-timing-function: ease-in-out;
|
|
8
9
|
}
|
|
9
10
|
|
|
11
|
+
SBar[color] {
|
|
12
|
+
fill: var(--color);
|
|
13
|
+
}
|
|
14
|
+
|
|
10
15
|
SBar[hide] {
|
|
11
16
|
display: none;
|
|
12
17
|
}
|
|
13
18
|
|
|
14
19
|
SBackground {
|
|
15
|
-
fill:
|
|
20
|
+
fill: var(--mystic);
|
|
16
21
|
}
|
|
@@ -1,5 +1,20 @@
|
|
|
1
|
+
@import '@semcore/utils/style/var.css';
|
|
2
|
+
@import '@semcore/d3-chart/src/style/var.css';
|
|
3
|
+
|
|
1
4
|
SPie {
|
|
2
5
|
stroke: #ffffff;
|
|
6
|
+
fill: var(--blue-01);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
SPie[color] {
|
|
10
|
+
fill: var(--color);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
SEmptyData {
|
|
14
|
+
fill: var(--mystic);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
SEmptyData[color] {
|
|
3
18
|
fill: var(--color);
|
|
4
19
|
}
|
|
5
20
|
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
@import '@semcore/utils/style/var.css';
|
|
2
|
+
@import '@semcore/d3-chart/src/style/var.css';
|
|
2
3
|
|
|
3
4
|
SDot {
|
|
4
5
|
stroke-width: 2px;
|
|
5
6
|
stroke: #fff;
|
|
6
7
|
r: 6px;
|
|
7
|
-
fill: var(--
|
|
8
|
+
fill: var(--blue-01);
|
|
8
9
|
transition-property: cx, cy;
|
|
9
10
|
transition-duration: var(--duration);
|
|
10
11
|
transition-timing-function: ease-in-out;
|
|
11
12
|
}
|
|
12
13
|
|
|
14
|
+
SDot[color] {
|
|
15
|
+
fill: var(--color);
|
|
16
|
+
}
|
|
17
|
+
|
|
13
18
|
SDot[hide] {
|
|
14
19
|
display: none;
|
|
15
20
|
}
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
@import '@semcore/utils/style/var.css';
|
|
2
|
+
@import '@semcore/d3-chart/src/style/var.css';
|
|
2
3
|
|
|
3
4
|
SLine {
|
|
4
5
|
fill: transparent;
|
|
5
6
|
stroke-width: 3;
|
|
6
|
-
stroke: var(--
|
|
7
|
+
stroke: var(--blue-01);
|
|
7
8
|
transition-property: d;
|
|
8
9
|
transition-duration: var(--duration);
|
|
9
10
|
transition-timing-function: ease-in-out;
|
|
10
11
|
}
|
|
11
12
|
|
|
13
|
+
SLine[color] {
|
|
14
|
+
stroke: var(--color);
|
|
15
|
+
}
|
|
16
|
+
|
|
12
17
|
SLine[hide] {
|
|
13
18
|
display: none;
|
|
14
19
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
@import '@semcore/utils/style/var.css';
|
|
2
|
+
@import '@semcore/d3-chart/src/style/var.css';
|
|
2
3
|
|
|
3
4
|
STooltip {
|
|
4
5
|
position: relative;
|
|
@@ -27,5 +28,9 @@ SDot {
|
|
|
27
28
|
height: 8px;
|
|
28
29
|
border-radius: 50%;
|
|
29
30
|
margin-right: 8px;
|
|
31
|
+
background: var(--blue-01);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
SDot[color] {
|
|
30
35
|
background: var(--color);
|
|
31
36
|
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--blue-01: #50aef4;
|
|
3
|
+
--blue-02: #91c7ef;
|
|
4
|
+
--blue-03: #0e75c2;
|
|
5
|
+
--blue-04: #d1e8f8;
|
|
6
|
+
--blue-05: #084c80;
|
|
7
|
+
--green-01: #3ab011;
|
|
8
|
+
--green-02: #91d27b;
|
|
9
|
+
--green-03: #278707;
|
|
10
|
+
--green-04: #d1edc8;
|
|
11
|
+
--green-05: #1a6700;
|
|
12
|
+
--orange-01: #ff8e29;
|
|
13
|
+
--orange-02: #fec089;
|
|
14
|
+
--orange-03: #da6905;
|
|
15
|
+
--orange-04: #ffe5cd;
|
|
16
|
+
--orange-05: #a14e03;
|
|
17
|
+
--violet-01: #890c85;
|
|
18
|
+
--violet-02: #c783c5;
|
|
19
|
+
--violet-03: #6e026b;
|
|
20
|
+
--violet-04: #e7cbe6;
|
|
21
|
+
--violet-05: #4d024b;
|
|
22
|
+
--red-01: #e91e25;
|
|
23
|
+
--red-02: #f69498;
|
|
24
|
+
--red-03: #bd0000;
|
|
25
|
+
--red-04: #fbd2d3;
|
|
26
|
+
--red-05: #830005;
|
|
27
|
+
--yellow-01: #ffc83f;
|
|
28
|
+
--yellow-02: #ffdb82;
|
|
29
|
+
--yellow-03: #e4aa18;
|
|
30
|
+
--yellow-04: #ffebb9;
|
|
31
|
+
--yellow-05: #b3840c;
|
|
32
|
+
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
@import '@semcore/d3-chart/src/style/var.css';
|
|
2
|
+
|
|
1
3
|
SCircle {
|
|
2
|
-
fill: var(--
|
|
4
|
+
fill: var(--green-01);
|
|
3
5
|
stroke: #fff;
|
|
4
6
|
stroke-width: 2px;
|
|
5
7
|
fill-opacity: 0.5;
|
|
@@ -12,6 +14,10 @@ SCircle {
|
|
|
12
14
|
}
|
|
13
15
|
}
|
|
14
16
|
|
|
17
|
+
SCircle[color] {
|
|
18
|
+
fill: var(--color);
|
|
19
|
+
}
|
|
20
|
+
|
|
15
21
|
SIntersection {
|
|
16
22
|
stroke: #fff;
|
|
17
23
|
stroke-width: 2px;
|
package/lib/types/Bar.d.ts
CHANGED
package/package.json
CHANGED
package/src/Area.js
CHANGED
|
@@ -14,8 +14,8 @@ class AreaRoot extends Component {
|
|
|
14
14
|
static style = style;
|
|
15
15
|
static enhance = [uniqueIDEnhancement()];
|
|
16
16
|
|
|
17
|
-
static defaultProps = ({ x, y, y0, $rootProps, curve = curveLinear }) => {
|
|
18
|
-
const [xScale, yScale] = $rootProps.scale;
|
|
17
|
+
static defaultProps = ({ x, y, y0, $rootProps, curve = curveLinear, scale }) => {
|
|
18
|
+
const [xScale, yScale] = scale || $rootProps.scale;
|
|
19
19
|
const yRange = yScale.range();
|
|
20
20
|
|
|
21
21
|
return {
|
|
@@ -30,7 +30,6 @@ class AreaRoot extends Component {
|
|
|
30
30
|
.curve(curve)
|
|
31
31
|
.x((p) => scaleOfBandwidth(xScale, p[x]))
|
|
32
32
|
.y((p) => scaleOfBandwidth(yScale, p[y])),
|
|
33
|
-
color: '#50aef4',
|
|
34
33
|
duration: 500,
|
|
35
34
|
};
|
|
36
35
|
};
|
package/src/Bar.js
CHANGED
|
@@ -14,7 +14,6 @@ class BarRoot extends Component {
|
|
|
14
14
|
static enhance = [uniqueIDEnhancement()];
|
|
15
15
|
|
|
16
16
|
static defaultProps = {
|
|
17
|
-
color: '#50aef4',
|
|
18
17
|
offset: [0, 0],
|
|
19
18
|
duration: 500,
|
|
20
19
|
r: 2,
|
|
@@ -74,7 +73,14 @@ class BarRoot extends Component {
|
|
|
74
73
|
yScale(d[y]) - Math.min(yScale(yScale.domain()[0]), yScale(d[y0] ?? 0)),
|
|
75
74
|
);
|
|
76
75
|
const width = widthProps || getBandwidth(xScale);
|
|
77
|
-
const
|
|
76
|
+
const dSvg = getRect({
|
|
77
|
+
x: barX,
|
|
78
|
+
y: barY,
|
|
79
|
+
width,
|
|
80
|
+
height,
|
|
81
|
+
radius: Array.isArray(r) ? r[i] : r,
|
|
82
|
+
position: d[y] > 0 ? 'top' : 'bottom',
|
|
83
|
+
});
|
|
78
84
|
|
|
79
85
|
return sstyled(styles)(
|
|
80
86
|
<SBar
|
|
@@ -87,14 +93,11 @@ class BarRoot extends Component {
|
|
|
87
93
|
index={i}
|
|
88
94
|
hide={hide}
|
|
89
95
|
color={color}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
radius: r,
|
|
96
|
-
position: d[y] > 0 ? 'top' : 'bottom',
|
|
97
|
-
})}
|
|
96
|
+
x={barX}
|
|
97
|
+
y={barY}
|
|
98
|
+
width={width}
|
|
99
|
+
height={height}
|
|
100
|
+
d={dSvg}
|
|
98
101
|
use:duration={`${duration}ms`}
|
|
99
102
|
/>,
|
|
100
103
|
);
|
package/src/Donut.js
CHANGED
|
@@ -181,12 +181,7 @@ class DonutRoot extends Component {
|
|
|
181
181
|
getEmptyDataProps() {
|
|
182
182
|
const { d3Arc } = this.asProps;
|
|
183
183
|
return {
|
|
184
|
-
data: {
|
|
185
|
-
endAngle: Math.PI * 2,
|
|
186
|
-
startAngle: 0,
|
|
187
|
-
},
|
|
188
184
|
d3Arc,
|
|
189
|
-
color: '#E4ECF1',
|
|
190
185
|
};
|
|
191
186
|
}
|
|
192
187
|
|
|
@@ -236,10 +231,16 @@ class DonutRoot extends Component {
|
|
|
236
231
|
}
|
|
237
232
|
}
|
|
238
233
|
|
|
239
|
-
function Pie({ Element: SPie, styles, d3Arc, data, color
|
|
234
|
+
function Pie({ Element: SPie, styles, d3Arc, data, color }) {
|
|
240
235
|
return sstyled(styles)(<SPie render="path" color={color} d={d3Arc(data)} />);
|
|
241
236
|
}
|
|
242
237
|
|
|
238
|
+
function EmptyData({ Element: SEmptyData, styles, d3Arc, color }) {
|
|
239
|
+
return sstyled(styles)(
|
|
240
|
+
<SEmptyData render="path" color={color} d={d3Arc({ endAngle: Math.PI * 2, startAngle: 0 })} />,
|
|
241
|
+
);
|
|
242
|
+
}
|
|
243
|
+
|
|
243
244
|
function Label({ Element: SLabel, styles, Children }) {
|
|
244
245
|
return sstyled(styles)(
|
|
245
246
|
<SLabel render="text" x="0" y="0">
|
|
@@ -248,6 +249,6 @@ function Label({ Element: SLabel, styles, Children }) {
|
|
|
248
249
|
);
|
|
249
250
|
}
|
|
250
251
|
|
|
251
|
-
const Donut = createElement(DonutRoot, { Pie, Label, EmptyData
|
|
252
|
+
const Donut = createElement(DonutRoot, { Pie, Label, EmptyData });
|
|
252
253
|
|
|
253
254
|
export default Donut;
|
package/src/GroupBar.js
CHANGED
|
@@ -20,10 +20,14 @@ class GroupBarRoot extends Component {
|
|
|
20
20
|
if (scaleGroup) return scaleGroup;
|
|
21
21
|
|
|
22
22
|
const domain = React.Children.toArray(getOriginChildren(Children)).reduce((acc, child) => {
|
|
23
|
-
if (React.isValidElement(child) && child.type === GroupBar.Bar) {
|
|
23
|
+
if (React.isValidElement(child) && child.type === GroupBar.Bar && !child.props.hide) {
|
|
24
24
|
acc.push(child.props.y);
|
|
25
25
|
}
|
|
26
|
-
if (
|
|
26
|
+
if (
|
|
27
|
+
React.isValidElement(child) &&
|
|
28
|
+
child.type === GroupBar.HorizontalBar &&
|
|
29
|
+
!child.props.hide
|
|
30
|
+
) {
|
|
27
31
|
acc.push(child.props.x);
|
|
28
32
|
}
|
|
29
33
|
return acc;
|
package/src/HorizontalBar.js
CHANGED
|
@@ -13,7 +13,6 @@ class HorizontalBarRoot extends Component {
|
|
|
13
13
|
static style = style;
|
|
14
14
|
|
|
15
15
|
static defaultProps = {
|
|
16
|
-
color: '#50aef4',
|
|
17
16
|
offset: [0, 0],
|
|
18
17
|
duration: 500,
|
|
19
18
|
r: 2,
|
|
@@ -44,12 +43,20 @@ class HorizontalBarRoot extends Component {
|
|
|
44
43
|
onMouseMove,
|
|
45
44
|
onMouseLeave,
|
|
46
45
|
} = this.asProps;
|
|
46
|
+
|
|
47
47
|
const [xScale, yScale] = scale;
|
|
48
48
|
const barY = yScale(d[y]) + offset[1];
|
|
49
49
|
const barX = xScale(Math.min(d[x0] ?? 0, d[x])) + offset[0];
|
|
50
50
|
const height = heightProps || getBandwidth(yScale);
|
|
51
51
|
const width = Math.abs(xScale(d[x]) - Math.max(xScale(xScale.domain()[0]), xScale(d[x0] ?? 0)));
|
|
52
|
-
const
|
|
52
|
+
const dSvg = getHorizontalRect({
|
|
53
|
+
x: barX,
|
|
54
|
+
y: barY,
|
|
55
|
+
width,
|
|
56
|
+
height,
|
|
57
|
+
radius: Array.isArray(r) ? r[i] : r,
|
|
58
|
+
position: d[x] > 0 ? 'right' : 'left',
|
|
59
|
+
});
|
|
53
60
|
|
|
54
61
|
return sstyled(styles)(
|
|
55
62
|
<SBar
|
|
@@ -62,14 +69,11 @@ class HorizontalBarRoot extends Component {
|
|
|
62
69
|
index={i}
|
|
63
70
|
hide={hide}
|
|
64
71
|
color={color}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
radius: r,
|
|
71
|
-
position: d[x] > 0 ? 'right' : 'left',
|
|
72
|
-
})}
|
|
72
|
+
x={barX}
|
|
73
|
+
y={barY}
|
|
74
|
+
width={width}
|
|
75
|
+
height={height}
|
|
76
|
+
d={dSvg}
|
|
73
77
|
use:duration={`${duration}ms`}
|
|
74
78
|
onMouseMove={onMouseMove}
|
|
75
79
|
onMouseLeave={onMouseLeave}
|
package/src/Line.js
CHANGED
|
@@ -14,15 +14,14 @@ class LineRoot extends Component {
|
|
|
14
14
|
static style = style;
|
|
15
15
|
static enhance = [uniqueIDEnhancement()];
|
|
16
16
|
|
|
17
|
-
static defaultProps = ({ x, y, $rootProps, curve = curveLinear }) => {
|
|
18
|
-
const [xScale, yScale] = $rootProps.scale;
|
|
17
|
+
static defaultProps = ({ x, y, $rootProps, curve = curveLinear, scale }) => {
|
|
18
|
+
const [xScale, yScale] = scale || $rootProps.scale;
|
|
19
19
|
return {
|
|
20
20
|
d3: d3Line()
|
|
21
21
|
.defined(definedData(x, y))
|
|
22
22
|
.curve(curve)
|
|
23
23
|
.x((p) => scaleOfBandwidth(xScale, p[x]))
|
|
24
24
|
.y((p) => scaleOfBandwidth(yScale, p[y])),
|
|
25
|
-
color: '#50aef4',
|
|
26
25
|
duration: 500,
|
|
27
26
|
};
|
|
28
27
|
};
|
package/src/StackBar.js
CHANGED
|
@@ -19,7 +19,7 @@ class StackBarRoot extends Component {
|
|
|
19
19
|
static defaultProps = () => {
|
|
20
20
|
const stack = d3Stack();
|
|
21
21
|
stack[DEFAULT_INSTANCE] = true;
|
|
22
|
-
return { stack };
|
|
22
|
+
return { stack, r: 2 };
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
getSeries() {
|
|
@@ -27,10 +27,14 @@ class StackBarRoot extends Component {
|
|
|
27
27
|
|
|
28
28
|
if (stack[DEFAULT_INSTANCE]) {
|
|
29
29
|
const keys = React.Children.toArray(getOriginChildren(Children)).reduce((acc, child) => {
|
|
30
|
-
if (React.isValidElement(child) && child.type === StackBar.Bar) {
|
|
30
|
+
if (React.isValidElement(child) && child.type === StackBar.Bar && !child.props.hide) {
|
|
31
31
|
acc.push(child.props.y);
|
|
32
32
|
}
|
|
33
|
-
if (
|
|
33
|
+
if (
|
|
34
|
+
React.isValidElement(child) &&
|
|
35
|
+
child.type === StackBar.HorizontalBar &&
|
|
36
|
+
!child.props.hide
|
|
37
|
+
) {
|
|
34
38
|
acc.push(child.props.x);
|
|
35
39
|
}
|
|
36
40
|
return acc;
|
|
@@ -42,9 +46,15 @@ class StackBarRoot extends Component {
|
|
|
42
46
|
}
|
|
43
47
|
|
|
44
48
|
getBarProps({ y }) {
|
|
45
|
-
const { x } = this.asProps;
|
|
49
|
+
const { x, r } = this.asProps;
|
|
46
50
|
|
|
47
|
-
const
|
|
51
|
+
const seriesIndex = this.series.findIndex((s) => s.key === y);
|
|
52
|
+
// or [] if hide bar
|
|
53
|
+
const series = this.series[seriesIndex] || [];
|
|
54
|
+
|
|
55
|
+
const rBar = series.map((s, i) =>
|
|
56
|
+
this.series.slice(seriesIndex + 1).some((bar) => bar[i][0] !== bar[i][1]) ? 0 : r,
|
|
57
|
+
);
|
|
48
58
|
|
|
49
59
|
return {
|
|
50
60
|
data: series.map((s) => ({
|
|
@@ -54,13 +64,19 @@ class StackBarRoot extends Component {
|
|
|
54
64
|
})),
|
|
55
65
|
y0: XY0,
|
|
56
66
|
x,
|
|
67
|
+
r: rBar,
|
|
57
68
|
};
|
|
58
69
|
}
|
|
59
70
|
|
|
60
71
|
getHorizontalBarProps({ x }) {
|
|
61
|
-
const { y } = this.asProps;
|
|
72
|
+
const { y, r } = this.asProps;
|
|
73
|
+
|
|
74
|
+
const seriesIndex = this.series.findIndex((s) => s.key === x);
|
|
75
|
+
const series = this.series[seriesIndex];
|
|
62
76
|
|
|
63
|
-
const
|
|
77
|
+
const rBar = series.map((s, i) =>
|
|
78
|
+
this.series.slice(seriesIndex + 1).some((bar) => bar[i][0] !== bar[i][1]) ? 0 : r,
|
|
79
|
+
);
|
|
64
80
|
|
|
65
81
|
return {
|
|
66
82
|
data: series.map((s) => ({
|
|
@@ -70,6 +86,7 @@ class StackBarRoot extends Component {
|
|
|
70
86
|
})),
|
|
71
87
|
x0: XY0,
|
|
72
88
|
y,
|
|
89
|
+
r: rBar,
|
|
73
90
|
};
|
|
74
91
|
}
|
|
75
92
|
|
package/src/StackedArea.js
CHANGED
|
@@ -26,7 +26,7 @@ class StackedAreaRoot extends Component {
|
|
|
26
26
|
|
|
27
27
|
if (stack[DEFAULT_INSTANCE]) {
|
|
28
28
|
const keys = React.Children.toArray(getOriginChildren(Children)).reduce((acc, child) => {
|
|
29
|
-
if (React.isValidElement(child) && child.type === StackedArea.Area) {
|
|
29
|
+
if (React.isValidElement(child) && child.type === StackedArea.Area && !child.props.hide) {
|
|
30
30
|
acc.push(child.props.y);
|
|
31
31
|
}
|
|
32
32
|
return acc;
|
|
@@ -39,7 +39,8 @@ class StackedAreaRoot extends Component {
|
|
|
39
39
|
|
|
40
40
|
getAreaProps({ y }) {
|
|
41
41
|
const { x } = this.asProps;
|
|
42
|
-
|
|
42
|
+
// or [] if hide area
|
|
43
|
+
const series = this.series.find((s) => s.key === y) || [];
|
|
43
44
|
return {
|
|
44
45
|
data: series.map((s) => ({
|
|
45
46
|
...s.data,
|
package/src/Tooltip.js
CHANGED
|
@@ -3,9 +3,9 @@ import { Component, Root, sstyled } from '@semcore/core';
|
|
|
3
3
|
import Popper from '@semcore/popper';
|
|
4
4
|
import { Box } from '@semcore/flex-box';
|
|
5
5
|
import findComponent from '@semcore/utils/lib/findComponent';
|
|
6
|
-
import resolveColor from '@semcore/utils/lib/color';
|
|
7
6
|
import { CONSTANT } from './utils';
|
|
8
7
|
import createElement from './createElement';
|
|
8
|
+
import resolveColor from '@semcore/utils/lib/color';
|
|
9
9
|
|
|
10
10
|
import style from './style/tooltip.shadow.css';
|
|
11
11
|
|
|
@@ -114,7 +114,7 @@ function Title(props) {
|
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
function Dot(props) {
|
|
117
|
-
const { styles, color
|
|
117
|
+
const { styles, color, Children } = props;
|
|
118
118
|
const SDotGroup = Root;
|
|
119
119
|
const SDot = Box;
|
|
120
120
|
return sstyled(styles)(
|
package/src/Venn.js
CHANGED
|
@@ -81,7 +81,7 @@ class VennRoot extends Component {
|
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
function Circle({ Element: SCircle, styles, color
|
|
84
|
+
function Circle({ Element: SCircle, styles, color, data, duration }) {
|
|
85
85
|
return sstyled(styles)(
|
|
86
86
|
<SCircle
|
|
87
87
|
render="circle"
|