sag_components 1.0.952 → 1.0.953

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.
@@ -50,16 +50,20 @@ const getFormattedValue = num => {
50
50
  if (isNaN(parseFloat(num))) {
51
51
  return null;
52
52
  }
53
+ const formatNumber = value => {
54
+ const fixedValue = value.toFixed(1);
55
+ return fixedValue.endsWith('.0') ? fixedValue.slice(0, -2) : fixedValue;
56
+ };
53
57
  if (Math.abs(num) >= 1000000000) {
54
- return (num / 1000000000).toFixed(1).replace(/\.0$/, '');
58
+ return formatNumber(num / 1000000000);
55
59
  }
56
60
  if (Math.abs(num) >= 1000000) {
57
- return (num / 1000000).toFixed(1).replace(/\.0$/, '');
61
+ return formatNumber(num / 1000000);
58
62
  }
59
63
  if (Math.abs(num) >= 1000) {
60
- return (num / 1000).toFixed(1).replace(/\.0$/, '');
64
+ return formatNumber(num / 1000);
61
65
  }
62
- return Number(num) % 1 === 0 ? num : Number(num).toFixed(1);
66
+ return formatNumber(num);
63
67
  };
64
68
  exports.getFormattedValue = getFormattedValue;
65
69
  const getNumberWithCommas = x => {
@@ -100,7 +100,7 @@ const SingleBarLineCharts = props => {
100
100
  textAnchor: "middle"
101
101
  }, "0"));
102
102
  }
103
- if (value === null || value === undefined || value === 'N/A') {
103
+ if (value === null || value === undefined) {
104
104
  return /*#__PURE__*/_react.default.createElement("g", null, /*#__PURE__*/_react.default.createElement("text", {
105
105
  x: x + width / 2,
106
106
  y: y - radius,
@@ -214,7 +214,7 @@ const SingleBarLineCharts = props => {
214
214
  var _item$lineValue;
215
215
  return {
216
216
  ...item,
217
- lineValue: (_item$lineValue = item.lineValue) !== null && _item$lineValue !== void 0 ? _item$lineValue : 0
217
+ lineValue: item.lineValue === 'N/A' ? 0 : (_item$lineValue = item.lineValue) !== null && _item$lineValue !== void 0 ? _item$lineValue : 0
218
218
  };
219
219
  }),
220
220
  margin: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sag_components",
3
- "version": "1.0.952",
3
+ "version": "1.0.953",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {