diff --git a/package.json b/package.json index d78491d..59d3bf7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-gifted-charts", - "version": "1.2.21", + "version": "1.2.22", "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.", "main": "src/index.tsx", "files": [ diff --git a/src/BarChart/index.tsx b/src/BarChart/index.tsx index be78240..1bb700e 100644 --- a/src/BarChart/index.tsx +++ b/src/BarChart/index.tsx @@ -630,9 +630,12 @@ export const BarChart = (props: PropTypes) => { outputRange: [0, totalWidth], }); - const getLabel = val => { + const getLabel = (val, index) => { let label = ''; - if (showFractionalValues) { + if ( + showFractionalValues || + (props.yAxisLabelTexts && props.yAxisLabelTexts[index] !== undefined) + ) { if (val) { label = val; } else { @@ -731,7 +734,7 @@ export const BarChart = (props: PropTypes) => { props.hideAxesAndRules !== true && !hideYAxisText && horizSections.map((sectionItems, index) => { - let label = getLabel(sectionItems.value); + let label = getLabel(sectionItems.value, index); if (hideOrigin && index === horizSections.length - 1) { label = ''; } @@ -852,6 +855,7 @@ export const BarChart = (props: PropTypes) => { horizSectionsBelow.map((sectionItems, index) => { let label = getLabel( horizSectionsBelow[horizSectionsBelow.length - 1 - index].value, + index, ); return ( { props.hideAxesAndRules !== true && !hideYAxisText && horizSections.map((sectionItems, index) => { - let label = getLabel(sectionItems.value); + let label = getLabel(sectionItems.value, index); if (hideOrigin && index === horizSections.length - 1) { label = ''; } diff --git a/src/LineChart/index.tsx b/src/LineChart/index.tsx index 7c02b13..9c8ebc8 100644 --- a/src/LineChart/index.tsx +++ b/src/LineChart/index.tsx @@ -1452,8 +1452,8 @@ export const LineChart = (props: propTypes) => { : defaultPointerConfig.pointerComponent; const showPointerStrip = - pointerConfig && pointerConfig.showPointerStrip - ? pointerConfig.showPointerStrip + pointerConfig && pointerConfig.showPointerStrip === false + ? false : defaultPointerConfig.showPointerStrip; const pointerStripHeight = pointerConfig && pointerConfig.pointerStripHeight @@ -1779,9 +1779,12 @@ export const LineChart = (props: propTypes) => { // ) // } - const getLabel = val => { + const getLabel = (val, index) => { let label = ''; - if (showFractionalValues) { + if ( + showFractionalValues || + (props.yAxisLabelTexts && props.yAxisLabelTexts[index] !== undefined) + ) { if (val) { label = props.yAxisOffset ? (Number(val) + props.yAxisOffset).toString() @@ -1882,7 +1885,7 @@ export const LineChart = (props: propTypes) => { props.hideAxesAndRules !== true && !hideYAxisText && horizSections.map((sectionItems, index) => { - let label = getLabel(sectionItems.value); + let label = getLabel(sectionItems.value, index); if (hideOrigin && index === horizSections.length - 1) { label = ''; } @@ -1987,6 +1990,7 @@ export const LineChart = (props: propTypes) => { horizSectionsBelow.map((sectionItems, index) => { let label = getLabel( horizSectionsBelow[horizSectionsBelow.length - 1 - index].value, + index, ); return ( { props.hideAxesAndRules !== true && !hideYAxisText && horizSections.map((sectionItems, index) => { - let label = getLabel(sectionItems.value); + let label = getLabel(sectionItems.value, index); if (hideOrigin && index === horizSections.length - 1) { label = ''; }