sag_components 1.0.523 → 1.0.525
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.
|
@@ -39,102 +39,28 @@ const TotalDoughnutChart = props => {
|
|
|
39
39
|
if (!DoughnutChartContainerRef) {
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
|
-
|
|
43
|
-
// let { offsetWidth, offsetHeight } = DoughnutChartContainerRef?.current;
|
|
44
|
-
|
|
45
|
-
// offsetWidth = offsetWidth / 3;
|
|
46
|
-
// offsetHeight = offsetHeight / 3;
|
|
47
|
-
// console.log("DoughnutChartContainerRef 2", offsetWidth, offsetHeight);
|
|
48
|
-
|
|
49
42
|
const {
|
|
50
43
|
current
|
|
51
44
|
} = DoughnutChartContainerRef;
|
|
52
|
-
console.log("DoughnutChartContainerRef
|
|
53
|
-
|
|
54
|
-
// console.log(
|
|
55
|
-
// "DoughnutChartContainerRef 3",
|
|
56
|
-
// Object.values(DoughnutChartContainerRef)
|
|
57
|
-
// );
|
|
58
|
-
|
|
59
|
-
// if (!current) {
|
|
60
|
-
// const currentArray = Object.values(DoughnutChartContainerRef);
|
|
61
|
-
// if (currentArray?.length > 0) {
|
|
62
|
-
// current = currentArray[0];
|
|
63
|
-
// }
|
|
64
|
-
|
|
65
|
-
// console.log("DoughnutChartContainerRef 4", current);
|
|
66
|
-
// }
|
|
67
|
-
|
|
45
|
+
console.log("DoughnutChartContainerRef 2", current);
|
|
68
46
|
if (!current) {
|
|
69
47
|
return;
|
|
70
48
|
}
|
|
71
49
|
const DoughnutChartContainerWidth = current === null || current === void 0 ? void 0 : current.offsetWidth;
|
|
72
50
|
const DoughnutChartContainerHeight = current === null || current === void 0 ? void 0 : current.offsetHeight;
|
|
73
|
-
console.log("DoughnutChartContainerRef
|
|
51
|
+
console.log("DoughnutChartContainerRef 3", DoughnutChartContainerWidth, DoughnutChartContainerHeight);
|
|
74
52
|
const radius = DoughnutChartContainerWidth > DoughnutChartContainerHeight ? DoughnutChartContainerHeight / 2 : DoughnutChartContainerWidth / 2;
|
|
75
53
|
setDoughnutChartRadius(radius);
|
|
76
54
|
}, [height, width]);
|
|
77
|
-
|
|
78
|
-
// useEffect(() => {
|
|
79
|
-
// console.log("DoughnutChartContainerRef 1", DoughnutChartContainerRef);
|
|
80
|
-
|
|
81
|
-
// if (!DoughnutChartContainerRef) {
|
|
82
|
-
// return;
|
|
83
|
-
// }
|
|
84
|
-
|
|
85
|
-
// const currentWidthHeght = Object.values(DoughnutChartContainerRef)?.map(
|
|
86
|
-
// (item) => (
|
|
87
|
-
// {
|
|
88
|
-
// offsetHeight: item.offsetHeight,
|
|
89
|
-
// offsetWidth: item.offsetWidth,
|
|
90
|
-
// }
|
|
91
|
-
// )
|
|
92
|
-
// );
|
|
93
|
-
|
|
94
|
-
// if (!currentWidthHeght || currentWidthHeght.length === 0) {
|
|
95
|
-
// return;
|
|
96
|
-
// }
|
|
97
|
-
// const offsetWidth = currentWidthHeght[0].offsetWidth;
|
|
98
|
-
// const offsetHeight = currentWidthHeght[0].offsetHeight;
|
|
99
|
-
|
|
100
|
-
// console.log(
|
|
101
|
-
// "DoughnutChartContainerRef 2",
|
|
102
|
-
// currentWidthHeght,
|
|
103
|
-
// offsetWidth,
|
|
104
|
-
// offsetHeight
|
|
105
|
-
// );
|
|
106
|
-
|
|
107
|
-
// const radius =
|
|
108
|
-
// offsetWidth > offsetHeight ? offsetHeight / 2 : offsetWidth / 2;
|
|
109
|
-
|
|
110
|
-
// setDoughnutChartRadius(radius);
|
|
111
|
-
// }, [ DoughnutChartContainerRef?.current?.offsetWidth, DoughnutChartContainerRef?.current?.offsetHeight]);
|
|
112
|
-
|
|
113
|
-
// const getRadius = () => {
|
|
114
|
-
// if (
|
|
115
|
-
// !DoughnutChartContainerRef?.current?.offsetWidth ||
|
|
116
|
-
// !DoughnutChartContainerRef?.current?.offsetHeight
|
|
117
|
-
// )
|
|
118
|
-
// return 0;
|
|
119
|
-
|
|
120
|
-
// const offsetWidth = DoughnutChartContainerRef?.current?.offsetWidth;
|
|
121
|
-
// const offsetHeight = DoughnutChartContainerRef?.current?.offsetHeight;
|
|
122
|
-
|
|
123
|
-
// const radius =
|
|
124
|
-
// offsetWidth > offsetHeight ? offsetHeight / 2 : offsetWidth / 2;
|
|
125
|
-
// return radius;
|
|
126
|
-
// };
|
|
127
|
-
|
|
128
|
-
return /*#__PURE__*/_react.default.createElement(_TotalDoughnutChart.ControlsContainer, {
|
|
55
|
+
return (legendData === null || legendData === void 0 ? void 0 : legendData.length) > 0 ? /*#__PURE__*/_react.default.createElement(_TotalDoughnutChart.ControlsContainer, {
|
|
129
56
|
id: "ControlsContainer",
|
|
130
57
|
height: height,
|
|
131
58
|
width: width,
|
|
132
59
|
textcolor: textcolor
|
|
133
|
-
},
|
|
60
|
+
}, /*#__PURE__*/_react.default.createElement(_TotalDoughnutChart.Controls, {
|
|
134
61
|
id: "Controls",
|
|
135
62
|
height: height,
|
|
136
|
-
width: width
|
|
137
|
-
ref: DoughnutChartContainerRef
|
|
63
|
+
width: width
|
|
138
64
|
}, /*#__PURE__*/_react.default.createElement(_TotalDoughnutChart.TitleAndValueContainer, {
|
|
139
65
|
id: "TitleAndValueContainer"
|
|
140
66
|
}, /*#__PURE__*/_react.default.createElement(_TotalDoughnutChart.Title, {
|
|
@@ -152,7 +78,8 @@ const TotalDoughnutChart = props => {
|
|
|
152
78
|
}, /*#__PURE__*/_react.default.createElement(_TotalDoughnutChart.DoughnutChartContainer, {
|
|
153
79
|
id: "DoughnutChartContainer",
|
|
154
80
|
width: width,
|
|
155
|
-
height: height
|
|
81
|
+
height: height,
|
|
82
|
+
ref: DoughnutChartContainerRef
|
|
156
83
|
}, /*#__PURE__*/_react.default.createElement(_recharts.ResponsiveContainer, null, /*#__PURE__*/_react.default.createElement(_recharts.PieChart, null, /*#__PURE__*/_react.default.createElement(_recharts.Pie, {
|
|
157
84
|
fill: "#8884d8",
|
|
158
85
|
dataKey: "value",
|
|
@@ -162,7 +89,7 @@ const TotalDoughnutChart = props => {
|
|
|
162
89
|
// outerRadius={getRadius() - 2}
|
|
163
90
|
// innerRadius={getRadius() - getRadius() / 3}
|
|
164
91
|
,
|
|
165
|
-
outerRadius: DoughnutChartRadius -
|
|
92
|
+
outerRadius: DoughnutChartRadius - 4,
|
|
166
93
|
innerRadius: DoughnutChartRadius - DoughnutChartRadius / 3
|
|
167
94
|
}, legendData.map(row => /*#__PURE__*/_react.default.createElement(_recharts.Cell, {
|
|
168
95
|
key: "cell-".concat(row.name),
|
|
@@ -192,9 +119,9 @@ const TotalDoughnutChart = props => {
|
|
|
192
119
|
style: {
|
|
193
120
|
fontWeight: itemsBoldedValues ? "700" : "500"
|
|
194
121
|
}
|
|
195
|
-
}, currencySign ? (0, _CommonFunctions.getCurrencySign)(currencyType, row.value) : "", row.value !== undefined && row.value !== null ? dotCutTrenty(row) : "No Data", row.value !== undefined && row.value !== null && dotCut ? (0, _CommonFunctions.getFormattedUnits)(row.value) : "", itemsPercentagesValueAside && " (".concat(Math.round(row.value / value * 100), "%)"))))))))) : /*#__PURE__*/_react.default.createElement(_NoDataFoundMessage.NoDataFoundMessage, {
|
|
122
|
+
}, currencySign ? (0, _CommonFunctions.getCurrencySign)(currencyType, row.value) : "", row.value !== undefined && row.value !== null ? dotCutTrenty(row) : "No Data", row.value !== undefined && row.value !== null && dotCut ? (0, _CommonFunctions.getFormattedUnits)(row.value) : "", itemsPercentagesValueAside && " (".concat(Math.round(row.value / value * 100), "%)")))))))))) : /*#__PURE__*/_react.default.createElement(_NoDataFoundMessage.NoDataFoundMessage, {
|
|
196
123
|
noDataText: noDataText
|
|
197
|
-
})
|
|
124
|
+
});
|
|
198
125
|
};
|
|
199
126
|
exports.TotalDoughnutChart = TotalDoughnutChart;
|
|
200
127
|
var _default = exports.default = TotalDoughnutChart;
|