This repository has been archived by the owner on Aug 1, 2022. It is now read-only.
Place adjacent annotations side-by-side instead of stacking #49
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.
Side-by-side annotations
(Sun, Thur), (Thur, Fri), and (Fri, Sat) comparisons are all placed on the same line, saving vertical space.
Original
(Thur, Fri) annotation is on a different line from (Sun, Thur) and (Fri, Sat) in the current master.
How does it work?
The current master vertically arranges annotations by creating a stack of vertical offsets over the center of each category. When an annotation is added, statannot checks the height of all the stacks between each of the categories being compared (inclusively) and uses/pushes an offset based on the height of the tallest stack. (If I remember correctly---I actually wrote the code in this PR months ago because I needed some really compact graphs in a hurry.)
This PR basically works the same way, but creates sub-stacks slightly to the left and right of the center of each category.
A.right_baseline
andB.left_baseline
, draw the annotation, and increment those two values.B.right_baseline
which is independent ofB.left_baseline
.A.right_baseline
,C.left_baseline
, andB.max_baseline
(whereB.max_baseline == max(B.left_baseline, B.right_baseline)
).New objects
This PR introduced a couple of new objects
_EligibleBaseline
and_EligibleBaselineGroup
to handle vertical annotation layout. In particular,_EligibleBaselineGroup
abstracts the process of calculating the vertical baseline for an annotation based on its horizontal position.