[graph] labels: add tick symbol, int precision, right margin #1931
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
One bugfix, and a few improvements to the graph labels.
First is a bugfix to an earlier commit of mine, fixing an error during drawing.
Next, if the graph is graphing integer data, the labels are currently formatted as ints. When zoomed in, seeing axis labels like "1 1 1 1" is not so informative, so this change formats them as floats: "1.0 1.2 1.4 1.6". This only happens when zoomed in, not at the default zoomlevel or when zoomed out.
I also added tick symbols to the x-axis, to clarify exactly which column the label applies to. The symbol defaults to
╵
(Box Drawing Light Up). It's particularly helpful when graphing with dates on the x-axis, since they are wide. It's also helpful at the right edge of the graph, where labels may shift to avoid overrunning the right edge of the window. When that happens, I've changed the behavior so the rightmost label moves entirely to the left side of its tick symbol.And the last change is to make the right margin expand dynamically, to be as large as necessary to fit the graph legend. This keeps the graph legend from covering up any plotted data points. But I capped the right margin so it takes up at most 1/4th of the window size.