Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TimeAxis doesn't respect minLabelDistance in specific scenarios #1240

Open
nebojsa-peric opened this issue Sep 30, 2024 · 1 comment
Open
Labels

Comments

@nebojsa-peric
Copy link
Collaborator

image

@nebojsa-peric nebojsa-peric changed the title TimeAxis doesn't respect minLabelDistnace in specific scenarios TimeAxis doesn't respect minLabelDistance in specific scenarios Sep 30, 2024
@nebojsa-peric
Copy link
Collaborator Author

Here's my finding, we calculate tick sizes using minTickDistance, in this case small number compared to minLabelDistance. tickSizes are calculated in the calculateTicks method, when the unit is equal to week, for this specific scenario, causing tickMeasure to be preserved as week. Additionally, at the end of the method, tickSizes are filtered by comparing them to minTickDistance value.

In the renderTicksAndLabels method of Axis class, following is done calculator.findTickSize(this.minLabelDistance);. Since minLabelDistance is much bigger than the minTickDistance, the function doesn't return the first tick size (week scale), but rather the second one (month scale). Later on in this function, following is done: var ticks = calculator.getTicks([size]);. The size here is a month of milliseconds, while the function relates to the tickMeasure value only (size property seems unused), and returns the values representing the weeks.

Increasing minTickUnit to 62 in the given example, "solves" the issue, however, it seems like this is a bug caused by not considering the size property in the getTicks function in scenario: ...else if (this.tickMeasure == "day" || this.tickMeasure == "week").
Fixing this might also solve the need to define minLabelDistance at first place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant