mantine icon indicating copy to clipboard operation
mantine copied to clipboard

withBarValueLabel not displaying in correct positions in BarChart

Open namakshenas opened this issue 1 year ago • 6 comments

Dependencies check up

  • [X] I have verified that I use latest version of all @mantine/* packages

What version of @mantine/* packages do you have in package.json?

7.13.2

What package has an issue?

@mantine/charts

What framework do you use?

Other, I will specify in the bug description

In which browsers you can reproduce the issue?

Chrome

Describe the bug

Hi,

I'm trying to use the withBarValueLabel property of BarChart. The value labels are not placed correctly. Here is the snapshot of the issue:

Screenshot 2024-10-17 at 16 08 52

Here is the working example in @mantine/charts:

<BarChart
          h={300}
          data={[
            { dmu: 'dmu1', 'Efficiency score': 100, Status: 'Efficient', color: '#32CD32' },
            { dmu: 'dmu2', 'Efficiency score': 78, Status: 'InEfficient', color: '#FFA500' },
            { dmu: 'dmu3', 'Efficiency score': 100, Status: 'Efficient', color: '#32CD32' },
            { dmu: 'dmu4', 'Efficiency score': 100, Status: 'Efficient', color: '#32CD32' },
            { dmu: 'dmu5', 'Efficiency score': 89, Status: 'InEfficient', color: '#FFA500' },
            { dmu: 'dmu6', 'Efficiency score': 95, Status: 'InEfficient', color: '#FFA500' },
          ]}
          withBarValueLabel
          orientation="vertical"
          gridAxis="y"
          barProps={{ radius: 5 }}
          dataKey="dmu"
          series={[{ name: 'Efficiency score' }]}
          tickLine="none"
/>

If possible, include a link to a codesandbox with a minimal reproduction

No response

Possible fix

No response

Self-service

  • [ ] I would be willing to implement a fix for this issue

namakshenas avatar Oct 17 '24 14:10 namakshenas

I'd like to work on this. Please assign if not picked up.

fsd-niraj avatar Oct 19 '24 15:10 fsd-niraj

You are welcome to submit a PR with a fix

rtivital avatar Oct 19 '24 15:10 rtivital

image

Please let me know if this looks good? I'll quickly raise my PR.

fsd-niraj avatar Oct 19 '24 22:10 fsd-niraj

image

Please let me know if this looks good? I'll quickly raise my PR.

Thanks. But they should be aligned right, where just after each bar ends in the right hand side.

namakshenas avatar Oct 19 '24 22:10 namakshenas

image image

How about this?

fsd-niraj avatar Oct 19 '24 23:10 fsd-niraj

image

image

How about this?

Looks great. But consider another scenario: what if the user chooses the bar width to be thin. In that case, the values should be placed outside of the bar.

namakshenas avatar Oct 20 '24 07:10 namakshenas

image

image

image

Hey, Let me know if this looks good to you.

fsd-niraj avatar Oct 21 '24 22:10 fsd-niraj

image

image

image

Hey, Let me know if this looks good to you.

Well done! I think you can now suggest your PR.

namakshenas avatar Oct 22 '24 06:10 namakshenas

PR: https://github.com/mantinedev/mantine/pull/7011

fsd-niraj avatar Oct 22 '24 16:10 fsd-niraj

Hey, I saw that the test case failed, is it still mergeable? I don't see any other problem than linting and prettier.

fsd-niraj avatar Oct 22 '24 17:10 fsd-niraj

To merge the PR, all tests must pass. To continue working on your PR, add more commits to the same branch and push them. You can run tests locally with npm test command.

rtivital avatar Oct 22 '24 17:10 rtivital

Hey @rtivital , heres my new PR, please check. https://github.com/mantinedev/mantine/pull/7042

fsd-niraj avatar Oct 27 '24 02:10 fsd-niraj