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

Add labelWidth prop to stacked bar charts #748

Conversation

nathanKramer
Copy link
Contributor

@nathanKramer nathanKramer commented Aug 2, 2024

This PR depends on Abhinandan-Kushwaha/gifted-charts-core#36

Follows the established pattern for bar charts to allow customizing label width on stacked bar charts.

This is needed to fix my stacked bar chart, where two stacked bars are close together under one label:

image

Labels with labelWidth look like this:

image

@@ -77,7 +77,12 @@ const RenderStackBars = (props: StackedBarChartPropsType) => {
style={[
{
width:
(item.stacks[0].barWidth || props.barWidth || 30) + spacing / 2,
(item.labelWidth ||
props.labelWidth ||
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't work until Abhinandan-Kushwaha/gifted-charts-core#36 is merged

@Abhinandan-Kushwaha Abhinandan-Kushwaha merged commit 9cf22c8 into Abhinandan-Kushwaha:master Aug 2, 2024
@Abhinandan-Kushwaha
Copy link
Owner

Abhinandan-Kushwaha commented Aug 2, 2024

Thanks for the PR @nathanKramer
Your changes are available from version 1.4.24 onwards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants