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

[charts] Separate tick labels vs data labels for bar charts #13419

Closed
eddiew opened this issue Jun 8, 2024 · 4 comments
Closed

[charts] Separate tick labels vs data labels for bar charts #13419

eddiew opened this issue Jun 8, 2024 · 4 comments
Labels
component: charts This is the name of the generic UI component, not the React module! customization: extend Logic customizability

Comments

@eddiew
Copy link

eddiew commented Jun 8, 2024

Summary

I'm using a bar chart as a histogram, and would like to label the histogram buckets separately from the tick labels, which ideally would represent the boundaries between buckets.

Examples

Screenshot 2024-06-07 at 11 14 00 PM

In this example, I'd like the tooltip header to read Apr 15 - Apr 22, rather than just Apr 15

Motivation

No response

Search keywords: bar chart, tick label, histogram

@eddiew eddiew added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Jun 8, 2024
@eddiew eddiew changed the title Separate tick labels vs data labels for bar charts [charts] Separate tick labels vs data labels for bar charts Jun 8, 2024
@eddiew eddiew changed the title [charts] Separate tick labels vs data labels for bar charts Separate tick labels vs data labels for bar charts Jun 8, 2024
@michelengelen michelengelen changed the title Separate tick labels vs data labels for bar charts [charts] Separate tick labels vs data labels for bar charts Jun 10, 2024
@michelengelen
Copy link
Member

Hey @eddiew ... this is already possible with a custom valueFormatter on the axis prop. Check out this section in the docs: axis formatter.

If you could provide a live code example from your specific implementation that would be great!

@michelengelen michelengelen added status: waiting for author Issue with insufficient information customization: extend Logic customizability component: charts This is the name of the generic UI component, not the React module! and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Jun 10, 2024
@eddiew
Copy link
Author

eddiew commented Jun 10, 2024

Ah, that answers my question. I hadn't thought of using the valueFormatter fn to look up the tick label from my data set separately, and it didn't occur to me to look at the tooltip docs for this.

One suggestion if possible - if a dataset is passed, it would be nice if the valueFormatter fn could take the entire data point as an argument, rather than just the label provided by dataKey. On second thought, it might even be simpler just to add an option like tickLabelKey for use with the dataset option - that way the valueFormatter fn can be bypassed entirely.

But otherwise feel free to close this, the solution provided works.

@github-actions github-actions bot added status: waiting for maintainer These issues haven't been looked at yet by a maintainer and removed status: waiting for author Issue with insufficient information labels Jun 10, 2024
Copy link

⚠️ This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue.
Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.

@eddiew: How did we do? Your experience with our support team matters to us. If you have a moment, please share your thoughts in this short Support Satisfaction survey.

@michelengelen
Copy link
Member

You're welcome! If you have any other questions or need further assistance, feel free to ask.

@michelengelen michelengelen removed the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Jun 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: charts This is the name of the generic UI component, not the React module! customization: extend Logic customizability
Projects
None yet
Development

No branches or pull requests

2 participants