@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: string[];
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, color } = props;
6
- useEffect(() => init(), []);
7
- const init = () => {
8
- const chart = new Chart({
9
- container: "shares-report-container",
10
- width: 180,
11
- height: 180,
12
- });
13
- chart.coordinate({ type: "theta", innerRadius: 0.25, outerRadius: 0.8 });
14
- chart
15
- .interval()
16
- .data(share)
17
- .transform({ type: "stackY" })
18
- .encode("y", "percentage")
19
- .encode("color", "name")
20
- .scale("color", { range: color })
21
- .tooltip((data) => ({
22
- name: data.name,
23
- value: `${data.shares}股 ${data.percentage}%`,
24
- }))
25
- .legend(false);
26
- chart.render();
27
- };
28
- return observe(() => React.createElement("div", { id: "shares-report-container" }));
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;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAG5C,MAAM,iBAAiB,GAAG,CAAC,KAA4C,EAAE,EAAE;IAC1E,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;IAE/B,SAAS,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;IAE5B,MAAM,IAAI,GAAG,GAAG,EAAE;QACjB,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC;YACvB,SAAS,EAAE,yBAAyB;YACpC,KAAK,EAAE,GAAG;YACV,MAAM,EAAE,GAAG;SACX,CAAC,CAAC;QACH,KAAK,CAAC,UAAU,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,EAAE,CAAC,CAAC;QACzE,KAAK;aACH,QAAQ,EAAE;aACV,IAAI,CAAC,KAAK,CAAC;aACX,SAAS,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;aAC7B,MAAM,CAAC,GAAG,EAAE,YAAY,CAAC;aACzB,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC;aACvB,KAAK,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;aAChC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YACnB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,KAAK,EAAE,GAAG,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC,UAAU,GAAG;SAC5C,CAAC,CAAC;aACF,MAAM,CAAC,KAAK,CAAC,CAAC;QAChB,KAAK,CAAC,MAAM,EAAE,CAAC;IAChB,CAAC,CAAC;IAEF,OAAO,OAAO,CAAC,GAAG,EAAE,CAAC,6BAAK,EAAE,EAAC,yBAAyB,GAAG,CAAC,CAAC;AAC5D,CAAC,CAAC;AAEF,eAAe,iBAAiB,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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mB;wBACnB,iBAAiB;wBACjB,YAAY;wBACZ,UAAU;wBACV,WAAW;wBACX,iDAAiD;wBACjD,iCAAiC;wBACjC,qBAAqB;wBACrB,MAAM;wBACN,MAAM;wBACN,OAAO,KAAK,CAAC;oBACd,CAAC;iBACD;gBACD,OAAO,EAAE;oBACR,kBAAkB;oBAClB,MAAM,EAAE,CAAC,MAAM,EAAE,YAAY,EAAE,QAAQ,CAAC;oBACxC,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE;wBACpB,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC,MAAM,KAAK,KAAK,CAAC,UAAU,GAAG,EAAE,CAAC;oBAC7E,CAAC;iBACD;gBACD,YAAY,EAAE,CAAC,EAAE,IAAI,EAAE,kBAAkB,EAAE,EAAE,EAAE,IAAI,EAAE,gBAAgB,EAAE,CAAC;aACxE,CAAC,CAAC;YACH,UAAU,CAAC,MAAM,EAAE,CAAC;QACrB,CAAC;IACF,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,OAAO,CAAC,GAAG,EAAE,CAAC,CACpB,6BAAK,SAAS,EAAC,kBAAkB;QAChC,6BAAK,GAAG,EAAE,KAAK,GAAI,CACd,CACN,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voplus/morpho-csp",
3
- "version": "6.0.114",
3
+ "version": "6.0.115",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://voplus.visualstudio.com/morpho-csp/_git/morpho-csp"