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

fix: use as many time ticks as d3 can fit on the x-axis #146

Merged
merged 3 commits into from
Jan 7, 2020

Conversation

TCL735
Copy link
Contributor

@TCL735 TCL735 commented Jan 7, 2020

Closes #135 and influxdata/influxdb#16395

Instead of using 'W' for the average character width, we measure the exact width of the label. Then we ask d3 to give us as many time ticks as will fit on the x-axis with the following restrictions to act as padding around the labels:

  • round down when finding the maximum number as the first suggestion to d3
  • four or more labels: the sum of all the lengths of the labels is shorter than the available space by at least one label's length
  • less than four labels: 0.25, 0.50, 0.75 label length as spacing for one, two, and three labels respectively

@TCL735 TCL735 requested review from asalem1 and ebb-tide January 7, 2020 01:10
Copy link
Contributor

@ebb-tide ebb-tide left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@TCL735 TCL735 merged commit b0ca39d into master Jan 7, 2020
@TCL735 TCL735 deleted the fix_135_x_axis_labeling_efficiency branch January 7, 2020 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

x-axis should label efficiently and fill the entire axis whenever possible
2 participants