sag_components 1.0.937 → 1.0.938

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.
@@ -59,7 +59,7 @@ const getFormattedValue = num => {
59
59
  if (Math.abs(num) >= 1000) {
60
60
  return (num / 1000).toFixed(1).replace(/\.0$/, '');
61
61
  }
62
- return Number(num).toFixed(1);
62
+ return Number(num) % 1 === 0 ? num : Number(num).toFixed(1);
63
63
  };
64
64
  exports.getFormattedValue = getFormattedValue;
65
65
  const getNumberWithCommas = x => {
@@ -23,21 +23,22 @@ const SingleBarLineCharts = props => {
23
23
  width,
24
24
  height,
25
25
  title,
26
+ data,
27
+ totalsData,
28
+ legendData,
29
+ maxBarRange,
30
+ lineRange,
26
31
  barSize,
27
- maxRange,
28
32
  barChartHeight,
29
33
  lineChartHeight,
30
- showSecondBar,
31
34
  isLineChartCurrency,
32
35
  isLineChartBolded,
33
36
  setLineChartTooltip,
34
37
  isTopBarPercent,
38
+ showSecondBar,
35
39
  showPeriod,
36
40
  currencySignLine,
37
41
  currencySign,
38
- data,
39
- totalsData,
40
- legendData,
41
42
  noDataText
42
43
  } = props;
43
44
  const [showLegendTooltip, setShowLegendTooltip] = (0, _react.useState)(false);
@@ -209,15 +210,15 @@ const SingleBarLineCharts = props => {
209
210
  data: data,
210
211
  margin: {
211
212
  top: 20,
212
- right: 100,
213
- left: 100,
214
- bottom: 10
213
+ right: 80,
214
+ left: 80,
215
+ bottom: 20
215
216
  }
216
217
  }, /*#__PURE__*/_react.default.createElement(_recharts.YAxis, {
217
218
  type: "number",
218
219
  width: 0,
219
220
  display: "none",
220
- domain: ['auto', dataMax => dataMax * maxRange],
221
+ domain: [dataMin => dataMin / lineRange, dataMax => dataMax * lineRange],
221
222
  allowDataOverflow: true
222
223
  }), /*#__PURE__*/_react.default.createElement(_recharts.Line, {
223
224
  type: "monotone",
@@ -235,24 +236,29 @@ const SingleBarLineCharts = props => {
235
236
  data: data,
236
237
  maxBarSize: 60,
237
238
  margin: {
238
- top: 30,
239
- right: 30,
240
- left: 30,
241
- bottom: 5
239
+ top: 20,
240
+ right: 0,
241
+ left: 0,
242
+ bottom: 20
242
243
  }
243
244
  }, /*#__PURE__*/_react.default.createElement(_recharts.XAxis, {
244
245
  dataKey: "retailer",
245
246
  tick: CustomizedTickBarChart,
246
247
  tickLine: false,
247
- height: 120,
248
+ height: 80,
248
249
  interval: 0,
249
250
  fill: "#212121"
250
251
  }), /*#__PURE__*/_react.default.createElement(_recharts.YAxis, {
251
252
  type: "number",
252
253
  width: 0,
253
254
  display: "none",
254
- domain: ['auto', dataMax => dataMax * maxRange],
255
- allowDataOverflow: true
255
+ allowDataOverflow: true,
256
+ domain: ['auto', dataMax => {
257
+ if (String(dataMax) === '-Infinity') {
258
+ return 0;
259
+ }
260
+ return dataMax * maxBarRange;
261
+ }]
256
262
  }), /*#__PURE__*/_react.default.createElement(_recharts.ReferenceLine, {
257
263
  y: 0,
258
264
  stroke: "#D0D0D0"
@@ -286,9 +292,14 @@ exports.SingleBarLineCharts = SingleBarLineCharts;
286
292
  var _default = exports.default = SingleBarLineCharts;
287
293
  SingleBarLineCharts.defaultProps = {
288
294
  className: '',
289
- title: '',
290
295
  width: '100%',
291
296
  height: '100%',
297
+ title: '',
298
+ data: [],
299
+ totalsData: [],
300
+ legendData: [],
301
+ maxBarRange: 1,
302
+ lineRange: 1,
292
303
  barSize: 60,
293
304
  barChartHeight: 250,
294
305
  lineChartHeight: 50,
@@ -296,13 +307,9 @@ SingleBarLineCharts.defaultProps = {
296
307
  isLineChartBolded: false,
297
308
  setLineChartTooltip: false,
298
309
  isTopBarPercent: true,
299
- maxRange: 1,
310
+ showSecondBar: true,
300
311
  showPeriod: true,
301
312
  currencySign: '€',
302
313
  currencySignLine: '€',
303
- showSecondBar: true,
304
- data: [],
305
- totalsData: [],
306
- legendData: [],
307
314
  noDataText: 'No data'
308
315
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sag_components",
3
- "version": "1.0.937",
3
+ "version": "1.0.938",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {