-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Dates are squished to the left for graphs #16395
Comments
Might be the same issue as influxdata/giraffe#135 We will keep both for now and ensure they are resolved together. |
giraffe uses d3 to determine the number of time ticks. d3 takes a suggestion on the number of ticks desired but will often ignore the suggestion and return the number of ticks based on its own algorithm. giraffe's estimate of the number of ticks is very conservative, using the width of 'W' for the average width of a character. This leads to many cases where giraffe is underestimating the amount of available space on the axis. In a battle of wills, giraffe truncates the array of time ticks when d3's length is longer than its own estimate. But d3 has already scaled the axis, leading to empty space at the end of the axis. Short of giving the user control over the number of time ticks on the x-axis, giraffe should not override d3's algorithm. The simple fix is simply to remove the if-block at https://github.com/influxdata/giraffe/blob/master/giraffe/src/utils/getTicks.ts#L45 |
There is one case where it is appropriate to override d3. When the actual length of the time tick label is longer than what d3.scaleUtc would create, such as this one:
which is another way of saying for example: d3 would overlap these labels making them unreadable.
Edit 2: We don't override. We call d3 with different numbers until the total number of ticks fits onto the x-axis. This will maximize the usage of the x-axis as per d3's algorithm. |
The text was updated successfully, but these errors were encountered: