sag_components 1.0.132 → 1.0.134
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.
|
@@ -45,7 +45,27 @@ var TotalBenchmarkBarchart = function TotalBenchmarkBarchart(_ref) {
|
|
|
45
45
|
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
46
46
|
heightFactor = _useState4[0],
|
|
47
47
|
setHeightFactor = _useState4[1];
|
|
48
|
+
var _useState5 = (0, _react.useState)([]),
|
|
49
|
+
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
50
|
+
formattedBarChartData = _useState6[0],
|
|
51
|
+
setFormattedBarChartData = _useState6[1];
|
|
48
52
|
var controlsContainerRef = (0, _react.useRef)();
|
|
53
|
+
(0, _react.useEffect)(function () {
|
|
54
|
+
var tempFormattedBarChartData = [];
|
|
55
|
+
if (barChartData && barChartData.length === 2) {
|
|
56
|
+
tempFormattedBarChartData.push({
|
|
57
|
+
title1: barChartData[0].title,
|
|
58
|
+
value1: barChartData[0].value,
|
|
59
|
+
formattedValue1: currency ? (0, _CommonFunctions.getCurrencySign)(currencyType).toString().concat("", (0, _CommonFunctions.getFormattedValue)(barChartData[0].value), "", (0, _CommonFunctions.getFormattedUnits)(barChartData[0].value)) : "",
|
|
60
|
+
color1: barChartData[0].color ? barChartData[0].color : "#79DB95",
|
|
61
|
+
title2: barChartData[1].title,
|
|
62
|
+
value2: barChartData[1].value,
|
|
63
|
+
formattedValue2: currency ? (0, _CommonFunctions.getCurrencySign)(currencyType).toString().concat("", (0, _CommonFunctions.getFormattedValue)(barChartData[1].value), "", (0, _CommonFunctions.getFormattedUnits)(barChartData[1].value)) : "",
|
|
64
|
+
color2: barChartData[1].color ? barChartData[1].color : "#D4C0FF"
|
|
65
|
+
});
|
|
66
|
+
setFormattedBarChartData(tempFormattedBarChartData);
|
|
67
|
+
}
|
|
68
|
+
}, [barChartData]);
|
|
49
69
|
(0, _react.useEffect)(function () {
|
|
50
70
|
var offsetWidth = controlsContainerRef.current.offsetWidth;
|
|
51
71
|
setRootFont(getRootFont(offsetWidth));
|
|
@@ -60,19 +80,6 @@ var TotalBenchmarkBarchart = function TotalBenchmarkBarchart(_ref) {
|
|
|
60
80
|
var fontRoot = (DEFAULT_ROOT_FONT * relation).toString().concat("", "px");
|
|
61
81
|
return fontRoot;
|
|
62
82
|
};
|
|
63
|
-
var formattedBarChartData = [];
|
|
64
|
-
if (barChartData && barChartData.length === 2) {
|
|
65
|
-
formattedBarChartData.push({
|
|
66
|
-
title1: barChartData[0].title,
|
|
67
|
-
value1: barChartData[0].value,
|
|
68
|
-
formattedValue1: currency ? (0, _CommonFunctions.getCurrencySign)(currencyType).toString().concat("", (0, _CommonFunctions.getFormattedValue)(barChartData[0].value), "", (0, _CommonFunctions.getFormattedUnits)(barChartData[0].value)) : "",
|
|
69
|
-
color1: barChartData[0].color ? barChartData[0].color : "#79DB95",
|
|
70
|
-
title2: barChartData[1].title,
|
|
71
|
-
value2: barChartData[1].value,
|
|
72
|
-
formattedValue2: currency ? (0, _CommonFunctions.getCurrencySign)(currencyType).toString().concat("", (0, _CommonFunctions.getFormattedValue)(barChartData[1].value), "", (0, _CommonFunctions.getFormattedUnits)(barChartData[1].value)) : "",
|
|
73
|
-
color2: barChartData[1].color ? barChartData[1].color : "#D4C0FF"
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
83
|
var getSizeFactor = function getSizeFactor() {
|
|
77
84
|
return rootFont.toString().replace("px", "") / DEFAULT_ROOT_FONT;
|
|
78
85
|
};
|
|
@@ -110,7 +117,7 @@ var TotalBenchmarkBarchart = function TotalBenchmarkBarchart(_ref) {
|
|
|
110
117
|
backgroundColor: "#F2F2F2"
|
|
111
118
|
})) : ""), /*#__PURE__*/_react.default.createElement(_TotalBenchmarkBarchartStyle.BarchartContainer, {
|
|
112
119
|
id: "BarchartContainer"
|
|
113
|
-
}, /*#__PURE__*/_react.default.createElement(_recharts.BarChart, {
|
|
120
|
+
}, formattedBarChartData && formattedBarChartData.length === 1 && /*#__PURE__*/_react.default.createElement(_recharts.BarChart, {
|
|
114
121
|
width: 224 * getSizeFactor(),
|
|
115
122
|
height: 104 * heightFactor,
|
|
116
123
|
data: formattedBarChartData,
|