carbon-charts icon indicating copy to clipboard operation
carbon-charts copied to clipboard

[Bug]: Too much space around bars in a bar chart with timescale if time range is large

Open mthaak opened this issue 2 years ago • 1 comments

Contact Details

No response

What happened?

The space left and right of the bars in a bar chart with timescale bottom axis is too much if time range is large:

image

^ use data testBug in the sandbox

For lower time ranges it looks fine:

image

^ use data testWorking in the sandbox

This bug was already reported in https://github.com/carbon-design-system/carbon-charts/issues/1343. However, I think their solution of adding the option timeScale: {addSpaceOnEdges: 0} does not lead to a satisfactory result because then there is no space at all:

image

It would be better if there is always at least one empty tick between the bars and the edges like when using data testWorking in the sandbox.

Version

0.57.0

Data & options used

See sandbox

Relevant log output

No response

Codesandbox example

https://codesandbox.io/s/pedantic-keldysh-llx57m?file=/src/index.js

mthaak avatar Dec 22 '22 09:12 mthaak

I worked around this bug by specifying a custom domain which includes an extra time period left and right of the chart data time range and then using CSS to hide the first and last ticks on the bottom axis

mthaak avatar Dec 22 '22 09:12 mthaak