react-native-gifted-charts 1.4.15 → 1.4.16

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": "react-native-gifted-charts",
3
- "version": "1.4.15",
3
+ "version": "1.4.16",
4
4
  "description": "The most complete library for Bar, Line, Area, Pie, Donut, Stacked Bar and Population Pyramid charts in React Native. Allows 2D, 3D, gradient, animations and live data updates.",
5
5
  "main": "src/index.tsx",
6
6
  "files": [
@@ -25,7 +25,7 @@
25
25
  "registry": "https://registry.npmjs.org/"
26
26
  },
27
27
  "dependencies": {
28
- "gifted-charts-core": "^0.1.11"
28
+ "gifted-charts-core": "^0.1.13"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@babel/core": "^7.22.5",
@@ -7,10 +7,12 @@ import {
7
7
  yAxisSides,
8
8
  HorizSectionsType,
9
9
  horizSectionPropTypes,
10
+ chartTypes,
10
11
  } from 'gifted-charts-core';
11
12
 
12
13
  export const renderHorizSections = (props: horizSectionPropTypes) => {
13
14
  const {
15
+ chartType,
14
16
  width,
15
17
  noOfSectionsBelowXAxis,
16
18
  totalWidth,
@@ -330,6 +332,12 @@ export const renderHorizSections = (props: horizSectionPropTypes) => {
330
332
  );
331
333
  };
332
334
 
335
+ const leftShiftForRIghtYaxis =
336
+ (width ? width + 20 : totalWidth) +
337
+ yAxisLabelWidth / 2 +
338
+ endSpacing -
339
+ (chartType === chartTypes.BAR ? 40 : 60);
340
+
333
341
  return (
334
342
  <>
335
343
  {onlyReferenceLines ? (
@@ -411,7 +419,7 @@ export const renderHorizSections = (props: horizSectionPropTypes) => {
411
419
  : stepHeight,
412
420
  },
413
421
  yAxisSide === yAxisSides.RIGHT && {
414
- left: (width ?? totalWidth) + yAxisLabelWidth / 2,
422
+ left: leftShiftForRIghtYaxis,
415
423
  },
416
424
  horizontal &&
417
425
  !yAxisAtTop && {
@@ -1518,18 +1518,17 @@ export const LineChart = (props: LineChartPropsType) => {
1518
1518
  }
1519
1519
  }
1520
1520
  if (dataSet?.length) {
1521
- if (dataSet[0].data[factor]) {
1522
- const ysForDataSet = dataSet.map(set => {
1523
- const item = set.data[factor];
1524
- const y =
1525
- containerHeight -
1521
+ const ysForDataSet = dataSet.map(set => {
1522
+ const item = set.data[factor];
1523
+ const y = item
1524
+ ? containerHeight -
1526
1525
  (item.value * containerHeight) / maxValue -
1527
1526
  (pointerRadius || pointerHeight / 2) +
1528
- 10;
1529
- return y;
1530
- });
1531
- setPointerYsForDataSet(ysForDataSet);
1532
- }
1527
+ 10
1528
+ : 0;
1529
+ return y;
1530
+ });
1531
+ setPointerYsForDataSet(ysForDataSet);
1533
1532
  }
1534
1533
  }}
1535
1534
  // onResponderReject={evt => {