Skip to content

Browser gets stuck when Axis's stepSize is big #5116

@ksfchen

Description

@ksfchen

Description

I was developing a 'DataUsage' line chart, the numbers of 'DataUsage' (unit is Byte) are big (>10^9). When I try to make the yaxis look pretty, the problem happened.

Steps to Reproduce

  1. set big stepSize of yaxis
  2. use big series data
  3. the browser will stuck

Expected Behavior

browser not get stuck

Cause

The scalar generates too many ticks, the error code is below:
Image

But I think the real problem is the implement of "Utils.getGCD" function
Image
After the operation of first three lines of code, a and b are scaled to the level of 10 to the power of p. With the default value of p being 7, that is, 10^7 to 10^8. If the maximum value of a and b is less than this range, a and b will be enlarged, which is no problem. If a and b are greater than this range, a and b will be reduced, which will obviously cause problems, making the final result less than the actual greatest common divisor of a and b.
By the way, the variable name "big" is confusing. I think "factor" would be much better.

Reproduction Link

https://codepen.io/wanglin-chen/pen/ogbePoV

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions