@voplus/morpho-csp 6.0.114 → 6.0.115
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.
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { IMember } from "../../../../../data/corporate";
|
|
3
|
+
import "./index.less";
|
|
3
4
|
declare const SharesReportChart: (props: {
|
|
4
5
|
share: IMember[];
|
|
5
|
-
color
|
|
6
|
+
color?: string[];
|
|
6
7
|
}) => React.JSX.Element;
|
|
7
8
|
export default SharesReportChart;
|
|
@@ -1,31 +1,75 @@
|
|
|
1
|
-
import React, { useEffect } from "react";
|
|
2
|
-
import { Chart } from "@antv/g2";
|
|
1
|
+
import React, { useEffect, useRef } from "react";
|
|
3
2
|
import { observe } from "@voplus/morpho-ui";
|
|
3
|
+
import { Pie, G2 } from "@antv/g2plot";
|
|
4
|
+
import "./index.less";
|
|
4
5
|
const SharesReportChart = (props) => {
|
|
5
|
-
const { share
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
6
|
+
const { share } = props;
|
|
7
|
+
const G = G2.getEngine("canvas");
|
|
8
|
+
const divEl = useRef(null);
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
if (divEl.current) {
|
|
11
|
+
const columnPlot = new Pie(divEl.current, {
|
|
12
|
+
width: 180,
|
|
13
|
+
height: 180,
|
|
14
|
+
appendPadding: 10,
|
|
15
|
+
data: share,
|
|
16
|
+
angleField: "shares",
|
|
17
|
+
colorField: "name",
|
|
18
|
+
radius: 0.75,
|
|
19
|
+
legend: false,
|
|
20
|
+
color: props.color,
|
|
21
|
+
label: {
|
|
22
|
+
type: "inner",
|
|
23
|
+
labelHeight: 40,
|
|
24
|
+
formatter: (data, mappingData) => {
|
|
25
|
+
const group = new G.Group({});
|
|
26
|
+
group.addShape({
|
|
27
|
+
type: "circle",
|
|
28
|
+
attrs: {
|
|
29
|
+
x: 0,
|
|
30
|
+
y: 0,
|
|
31
|
+
width: 40,
|
|
32
|
+
height: 50,
|
|
33
|
+
r: 5,
|
|
34
|
+
fill: mappingData.color,
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
// group.addShape({
|
|
38
|
+
// type: "text",
|
|
39
|
+
// attrs: {
|
|
40
|
+
// x: 10,
|
|
41
|
+
// y: 8,
|
|
42
|
+
// text: `${data.name}`,
|
|
43
|
+
// fill: mappingData.color,
|
|
44
|
+
// },
|
|
45
|
+
// });
|
|
46
|
+
// group.addShape({
|
|
47
|
+
// type: "text",
|
|
48
|
+
// attrs: {
|
|
49
|
+
// x: 0,
|
|
50
|
+
// y: 25,
|
|
51
|
+
// text: `${data.shares}股 ${data.percentage}%`,
|
|
52
|
+
// fill: "rgba(0, 0, 0, 0.65)",
|
|
53
|
+
// fontWeight: 700,
|
|
54
|
+
// },
|
|
55
|
+
// });
|
|
56
|
+
return group;
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
tooltip: {
|
|
60
|
+
// 默认tooltip要显示的字段
|
|
61
|
+
fields: ["name", "percentage", "shares"],
|
|
62
|
+
formatter: (datum) => {
|
|
63
|
+
return { name: datum.name, value: `${datum.shares}股 ${datum.percentage}%` };
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
interactions: [{ type: "element-selected" }, { type: "element-active" }],
|
|
67
|
+
});
|
|
68
|
+
columnPlot.render();
|
|
69
|
+
}
|
|
70
|
+
}, []);
|
|
71
|
+
return observe(() => (React.createElement("div", { className: "shares-card-item" },
|
|
72
|
+
React.createElement("div", { ref: divEl }))));
|
|
29
73
|
};
|
|
30
74
|
export default SharesReportChart;
|
|
31
75
|
//# sourceMappingURL=SharesReportChart.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SharesReportChart.js","sourceRoot":"","sources":["../../../../../../src/modules/corporate/company/components/SharesCard2/SharesReportChart.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"SharesReportChart.js","sourceRoot":"","sources":["../../../../../../src/modules/corporate/company/components/SharesCard2/SharesReportChart.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,cAAc,CAAC;AAEtB,MAAM,iBAAiB,GAAG,CAAC,KAA6C,EAAE,EAAE;IAC3E,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;IACxB,MAAM,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IACjC,MAAM,KAAK,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAE3C,SAAS,CAAC,GAAG,EAAE;QACd,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;YACnB,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,OAAO,EAAE;gBACzC,KAAK,EAAE,GAAG;gBACV,MAAM,EAAE,GAAG;gBACX,aAAa,EAAE,EAAE;gBACjB,IAAI,EAAE,KAAK;gBACX,UAAU,EAAE,QAAQ;gBACpB,UAAU,EAAE,MAAM;gBAClB,MAAM,EAAE,IAAI;gBACZ,MAAM,EAAE,KAAK;gBACb,KAAK,EAAE,KAAK,CAAC,KAAK;gBAClB,KAAK,EAAE;oBACN,IAAI,EAAE,OAAO;oBACb,WAAW,EAAE,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