fixed issue with yAxisLabelTexts having . and pointerStrip still visible when set to hidden
This commit is contained in:
parent
651a2d3f59
commit
ae7f22f991
|
@ -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": [
|
||||
|
|
|
@ -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 (
|
||||
<View
|
||||
|
@ -906,7 +910,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 = '';
|
||||
}
|
||||
|
|
|
@ -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 (
|
||||
<View
|
||||
|
@ -2041,7 +2045,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 = '';
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue