react-native-gifted-charts 1.2.21 → 1.2.22

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.2.21",
3
+ "version": "1.2.22",
4
4
  "description": "The most complete library for Bar, Line, Area, Pie, Donut and Stacked Bar charts in React Native. Allows 2D, 3D, gradient, animations and live data updates.",
5
5
  "main": "src/index.tsx",
6
6
  "files": [
@@ -630,9 +630,12 @@ export const BarChart = (props: PropTypes) => {
630
630
  outputRange: [0, totalWidth],
631
631
  });
632
632
 
633
- const getLabel = val => {
633
+ const getLabel = (val, index) => {
634
634
  let label = '';
635
- if (showFractionalValues) {
635
+ if (
636
+ showFractionalValues ||
637
+ (props.yAxisLabelTexts && props.yAxisLabelTexts[index] !== undefined)
638
+ ) {
636
639
  if (val) {
637
640
  label = val;
638
641
  } else {
@@ -731,7 +734,7 @@ export const BarChart = (props: PropTypes) => {
731
734
  props.hideAxesAndRules !== true &&
732
735
  !hideYAxisText &&
733
736
  horizSections.map((sectionItems, index) => {
734
- let label = getLabel(sectionItems.value);
737
+ let label = getLabel(sectionItems.value, index);
735
738
  if (hideOrigin && index === horizSections.length - 1) {
736
739
  label = '';
737
740
  }
@@ -852,6 +855,7 @@ export const BarChart = (props: PropTypes) => {
852
855
  horizSectionsBelow.map((sectionItems, index) => {
853
856
  let label = getLabel(
854
857
  horizSectionsBelow[horizSectionsBelow.length - 1 - index].value,
858
+ index,
855
859
  );
856
860
  return (
857
861
  <View
@@ -906,7 +910,7 @@ export const BarChart = (props: PropTypes) => {
906
910
  props.hideAxesAndRules !== true &&
907
911
  !hideYAxisText &&
908
912
  horizSections.map((sectionItems, index) => {
909
- let label = getLabel(sectionItems.value);
913
+ let label = getLabel(sectionItems.value, index);
910
914
  if (hideOrigin && index === horizSections.length - 1) {
911
915
  label = '';
912
916
  }
@@ -1452,8 +1452,8 @@ export const LineChart = (props: propTypes) => {
1452
1452
  : defaultPointerConfig.pointerComponent;
1453
1453
 
1454
1454
  const showPointerStrip =
1455
- pointerConfig && pointerConfig.showPointerStrip
1456
- ? pointerConfig.showPointerStrip
1455
+ pointerConfig && pointerConfig.showPointerStrip === false
1456
+ ? false
1457
1457
  : defaultPointerConfig.showPointerStrip;
1458
1458
  const pointerStripHeight =
1459
1459
  pointerConfig && pointerConfig.pointerStripHeight
@@ -1779,9 +1779,12 @@ export const LineChart = (props: propTypes) => {
1779
1779
  // )
1780
1780
  // }
1781
1781
 
1782
- const getLabel = val => {
1782
+ const getLabel = (val, index) => {
1783
1783
  let label = '';
1784
- if (showFractionalValues) {
1784
+ if (
1785
+ showFractionalValues ||
1786
+ (props.yAxisLabelTexts && props.yAxisLabelTexts[index] !== undefined)
1787
+ ) {
1785
1788
  if (val) {
1786
1789
  label = props.yAxisOffset
1787
1790
  ? (Number(val) + props.yAxisOffset).toString()
@@ -1882,7 +1885,7 @@ export const LineChart = (props: propTypes) => {
1882
1885
  props.hideAxesAndRules !== true &&
1883
1886
  !hideYAxisText &&
1884
1887
  horizSections.map((sectionItems, index) => {
1885
- let label = getLabel(sectionItems.value);
1888
+ let label = getLabel(sectionItems.value, index);
1886
1889
  if (hideOrigin && index === horizSections.length - 1) {
1887
1890
  label = '';
1888
1891
  }
@@ -1987,6 +1990,7 @@ export const LineChart = (props: propTypes) => {
1987
1990
  horizSectionsBelow.map((sectionItems, index) => {
1988
1991
  let label = getLabel(
1989
1992
  horizSectionsBelow[horizSectionsBelow.length - 1 - index].value,
1993
+ index,
1990
1994
  );
1991
1995
  return (
1992
1996
  <View
@@ -2041,7 +2045,7 @@ export const LineChart = (props: propTypes) => {
2041
2045
  props.hideAxesAndRules !== true &&
2042
2046
  !hideYAxisText &&
2043
2047
  horizSections.map((sectionItems, index) => {
2044
- let label = getLabel(sectionItems.value);
2048
+ let label = getLabel(sectionItems.value, index);
2045
2049
  if (hideOrigin && index === horizSections.length - 1) {
2046
2050
  label = '';
2047
2051
  }