Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Axis Components: Add option to ignore nullish/empty object entries in data array #2883

Open
1 task done
vikas-nf opened this issue Jun 23, 2022 · 1 comment
Open
1 task done
Labels
enhancement Enhancement to a current API feature request Issues that are feature requests

Comments

@vikas-nf
Copy link

vikas-nf commented Jun 23, 2022

  • I have searched the issues of this repository and believe that this is not a duplicate.

Reproduction link

Edit on CodeSandbox

Steps to reproduce

Just Run the Fork, it will display the Chart

What is expected?

The Secondary X Axis should display the Data in Center

What is actually happening?

If we inject a blank object in starting or in end, it is causing the secondary axis to mis calculate the positioning of labels

Environment Info
Recharts v2.0.6
React React17.01
System Mac OS
Browser Chrom

I have a wide chart window, and I want to inject a blank object in start and end so my chart looks better (believe me, it is working like a charm), but it is messed up for the two x axis charts. I am not sure why it is dividing it in three sections, it is kinda confusing, any help here?
Screenshot at Jun 24 00-19-42

@ckifer
Copy link
Member

ckifer commented Aug 25, 2023

this makes sense and can be solved by simple data manipulation on your side.

Not an incorrect calculation, just a preference on how to treat empty or nullish values in the data array.

we should probably add a preference on how to treat empty objects/nulls/undefined in axis items. Some may want them, others may not.

@ckifer ckifer added enhancement Enhancement to a current API feature request Issues that are feature requests labels Aug 25, 2023
@ckifer ckifer changed the title Incorrect Calculations and Displaying for Multi X Axis Charts Axis Components: Add option to ignore nullish/empty object entries in data array Aug 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement to a current API feature request Issues that are feature requests
Projects
None yet
Development

No branches or pull requests

2 participants