gifted-charts-core 0.0.33 → 0.0.35

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gifted-charts-core",
3
- "version": "0.0.33",
3
+ "version": "0.0.35",
4
4
  "description": "Mathematical and logical utilities used by react-gifted-charts and react-native-gifted-charts",
5
5
  "main": "./src/index.js",
6
6
  "files": [
@@ -215,7 +215,9 @@ export var useBarChart = function (props) {
215
215
  ? !!responderActive
216
216
  : true
217
217
  : false);
218
- var yAxisExtraHeightAtTop = (_39 = props.yAxisExtraHeight) !== null && _39 !== void 0 ? _39 : containerHeight / 20;
218
+ var yAxisExtraHeightAtTop = props.trimYAxisAtTop
219
+ ? 0
220
+ : (_39 = props.yAxisExtraHeight) !== null && _39 !== void 0 ? _39 : containerHeight / 20;
219
221
  var barInnerComponent = props.barInnerComponent;
220
222
  useEffect(function () {
221
223
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2;
@@ -333,7 +333,9 @@ export const useBarChart = (props: extendedBarChartPropsType) => {
333
333
  : true
334
334
  : false)
335
335
 
336
- const yAxisExtraHeightAtTop = props.yAxisExtraHeight ?? containerHeight / 20
336
+ const yAxisExtraHeightAtTop = props.trimYAxisAtTop
337
+ ? 0
338
+ : props.yAxisExtraHeight ?? containerHeight / 20
337
339
 
338
340
  const barInnerComponent = props.barInnerComponent
339
341
 
@@ -160,6 +160,7 @@ export declare const useLineChart: (props: extendedLineChartPropsType) => {
160
160
  areaChart4: boolean;
161
161
  areaChart5: boolean;
162
162
  atLeastOneAreaChart: boolean;
163
+ getIsNthAreaChart: (n: number) => boolean;
163
164
  stepChart: boolean;
164
165
  stepChart1: boolean;
165
166
  stepChart2: boolean;
@@ -192,6 +192,25 @@ export var useLineChart = function (props) {
192
192
  var areaChart4 = (_62 = props.areaChart4) !== null && _62 !== void 0 ? _62 : false;
193
193
  var areaChart5 = (_63 = props.areaChart5) !== null && _63 !== void 0 ? _63 : false;
194
194
  var atLeastOneAreaChart = (_69 = (_68 = (_67 = (_66 = (_65 = (_64 = dataSet === null || dataSet === void 0 ? void 0 : dataSet.some(function (set) { return set.areaChart; })) !== null && _64 !== void 0 ? _64 : areaChart) !== null && _65 !== void 0 ? _65 : areaChart1) !== null && _66 !== void 0 ? _66 : areaChart2) !== null && _67 !== void 0 ? _67 : areaChart3) !== null && _68 !== void 0 ? _68 : areaChart4) !== null && _69 !== void 0 ? _69 : areaChart5;
195
+ var getIsNthAreaChart = function (n) {
196
+ if (areaChart)
197
+ return true;
198
+ if (!(dataSet === null || dataSet === void 0 ? void 0 : dataSet.length)) {
199
+ switch (n) {
200
+ case 0:
201
+ return areaChart1;
202
+ case 1:
203
+ return areaChart2;
204
+ case 2:
205
+ return areaChart3;
206
+ case 3:
207
+ return areaChart4;
208
+ case 4:
209
+ return areaChart5;
210
+ }
211
+ }
212
+ return false;
213
+ };
195
214
  var stepChart = (_70 = props.stepChart) !== null && _70 !== void 0 ? _70 : false;
196
215
  var stepChart1 = (_71 = props.stepChart1) !== null && _71 !== void 0 ? _71 : false;
197
216
  var stepChart2 = (_72 = props.stepChart2) !== null && _72 !== void 0 ? _72 : false;
@@ -347,7 +366,9 @@ export var useLineChart = function (props) {
347
366
  showArrow: (_231 = (_230 = props.secondaryLineConfig) === null || _230 === void 0 ? void 0 : _230.showArrow) !== null && _231 !== void 0 ? _231 : props.showArrows,
348
367
  arrowConfig: (_233 = (_232 = props.secondaryLineConfig) === null || _232 === void 0 ? void 0 : _232.arrowConfig) !== null && _233 !== void 0 ? _233 : props.arrowConfig
349
368
  };
350
- var yAxisExtraHeightAtTop = (_234 = props.yAxisExtraHeight) !== null && _234 !== void 0 ? _234 : containerHeight / 20;
369
+ var yAxisExtraHeightAtTop = props.trimYAxisAtTop
370
+ ? 0
371
+ : (_234 = props.yAxisExtraHeight) !== null && _234 !== void 0 ? _234 : containerHeight / 20;
351
372
  var addLeadingAndTrailingPathForAreaFill = function (initialPath, value, dataLength) {
352
373
  return ('M ' +
353
374
  initialSpacing +
@@ -1206,6 +1227,7 @@ export var useLineChart = function (props) {
1206
1227
  areaChart4: areaChart4,
1207
1228
  areaChart5: areaChart5,
1208
1229
  atLeastOneAreaChart: atLeastOneAreaChart,
1230
+ getIsNthAreaChart: getIsNthAreaChart,
1209
1231
  stepChart: stepChart,
1210
1232
  stepChart1: stepChart1,
1211
1233
  stepChart2: stepChart2,
@@ -372,6 +372,25 @@ export const useLineChart = (props: extendedLineChartPropsType) => {
372
372
  areaChart4 ??
373
373
  areaChart5
374
374
 
375
+ const getIsNthAreaChart = (n: number): boolean => {
376
+ if (areaChart) return true
377
+ if (!dataSet?.length) {
378
+ switch (n) {
379
+ case 0:
380
+ return areaChart1
381
+ case 1:
382
+ return areaChart2
383
+ case 2:
384
+ return areaChart3
385
+ case 3:
386
+ return areaChart4
387
+ case 4:
388
+ return areaChart5
389
+ }
390
+ }
391
+ return false
392
+ }
393
+
375
394
  const stepChart = props.stepChart ?? false
376
395
  const stepChart1 = props.stepChart1 ?? false
377
396
  const stepChart2 = props.stepChart2 ?? false
@@ -638,7 +657,10 @@ export const useLineChart = (props: extendedLineChartPropsType) => {
638
657
  showArrow: props.secondaryLineConfig?.showArrow ?? props.showArrows,
639
658
  arrowConfig: props.secondaryLineConfig?.arrowConfig ?? props.arrowConfig
640
659
  }
641
- const yAxisExtraHeightAtTop = props.yAxisExtraHeight ?? containerHeight / 20
660
+
661
+ const yAxisExtraHeightAtTop = props.trimYAxisAtTop
662
+ ? 0
663
+ : props.yAxisExtraHeight ?? containerHeight / 20
642
664
 
643
665
  const addLeadingAndTrailingPathForAreaFill = (
644
666
  initialPath: string,
@@ -1915,6 +1937,7 @@ export const useLineChart = (props: extendedLineChartPropsType) => {
1915
1937
  areaChart4,
1916
1938
  areaChart5,
1917
1939
  atLeastOneAreaChart,
1940
+ getIsNthAreaChart,
1918
1941
  stepChart,
1919
1942
  stepChart1,
1920
1943
  stepChart2,