Add hoverable data values for single-bar nanoplots #1519
Merged
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.
This PR makes single-bar nanoplots display their values on hover. As these types of nanoplots can have a mix of positive, negative, and zero-value bars, it was important to ensure that the compactly-formatted data values are affixed to the zero-line, with the text anchored on the appropriate side. Zero value labels were adjusted to lie in a more central position (since there is no bar). The user could hover virtually anywhere in the cell and the value will then appear (i.e., the hover area is large for convenience).
Here we also add the
interactive_data_values
argument to thenanoplot_options()
function. This allows for having persistent data values shown on the single-bar nanoplots. This may be desirable in some cases since there is only a single value per nanoplot (i.e., clutter won't be an issue) and having a compactly formatted value present is commonly seen in bar plots.Here is an example of this:
If that option is unset or
TRUE
(i.e., the default display) we get this:where the screenshot was taken while hovering over the second nanoplot.
Fixes: #1517