evidence icon indicating copy to clipboard operation
evidence copied to clipboard

[Bug]: Bar chart inside Data Table should align to the right when Column aligns right

Open kmitchener opened this issue 1 year ago • 6 comments

Describe the bug

Current behavior when column is aligned right with a bar chart in it:

<Column id=last_month_cost fmt=usd title="Last Month AWS Cost" align=right contentType=bar />

Current behaviour

Image

Desired behavior

Image

Steps to Reproduce

Create datatable with column aligned right with bar chart inside. Example column description above.

Severity

annoyance

kmitchener avatar Nov 05 '24 14:11 kmitchener

Hey @kmitchener, what would your expected behaviour be here for negative values?

archiewood avatar Nov 05 '24 14:11 archiewood

Can you achieve this by making the values in the column negative, then adjust the fmt?

hughess avatar Nov 05 '24 15:11 hughess

Negative values could be flipped in the opposite direction, but this might be confusing

Image

Current left align behaviour for reference

Image

archiewood avatar Nov 05 '24 15:11 archiewood

Here's a live proof of concept: https://deploy-preview-2726--next-docs-evidence.netlify.app/components/data-table/#bar-chart-column---right-aligned

archiewood avatar Nov 05 '24 15:11 archiewood

That looks great to me. In my use case, I won't have mixed positive and negative values. For your POC, I wonder how that would look with much larger negative values?

kmitchener avatar Nov 05 '24 18:11 kmitchener

I'm not loving this approach honestly. I wonder if it would be better to introduce a new independent prop to control this eg barAlign=right I think some users are likely to want the text to be right aligned, but the bar not

archiewood avatar Nov 07 '24 21:11 archiewood