Ngx-charts: Area Chart regression, the y axis is in the middle instead of being aligned to the bottom

Created on 27 Jan 2020  路  5Comments  路  Source: swimlane/ngx-charts

Describe the bug
When using area-chart with the y axis = 0 (or any other const value), the line of the y axis is in the middle instead of being aligned to the bottom

It worked well in version 12.1.0:
Screen Shot 2020-01-27 at 16 33 15

Issue started with upgrading to version 13.0.1 (as well 13.0.2, but I didn't tried 13.0.0):
Screen Shot 2020-01-27 at 16 41 29

To Reproduce
Steps to reproduce the behavior:

  1. Create area-chart
  2. Use the same number for the y axis for all the points

Expected behavior
The Y axis should be aligned to the bottom

Bug

Most helpful comment

It seems to be due to upgrading d3-scale version.

d3-scale v2.0.0 later:
When the domain value becomes [0, 0], the offset of axis-tick calculated by scaleLinear.range() is halved.

Can I downgrade the d3-scale version for fix ?

Please give me a review :D

All 5 comments

Reproduced with other chart-components has y axis (13.0.1).
e.g. ngx-charts-bar-vertical

image

Reverting commit d196e94deb54d910ee59567c5b96bab7fc607a36 , it works fine.
Issue with the version of d3js?

It seems to be due to upgrading d3-scale version.

d3-scale v2.0.0 later:
When the domain value becomes [0, 0], the offset of axis-tick calculated by scaleLinear.range() is halved.

Can I downgrade the d3-scale version for fix ?

Please give me a review :D

Is there any workaround for this in the meantime? Ran into this issue as well.

Thanks for the awesome library!

Any updates on this? Facing the same issue. Thanks!

Was this page helpful?
0 / 5 - 0 ratings