-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use list of variable names for tooltip configuration (#376)
- Loading branch information
1 parent
87d8031
commit fc908bd
Showing
9 changed files
with
386 additions
and
95 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Tooltip Customization | ||
|
||
- [Tooltip variable list](#variables) | ||
- [Examples](#example-variables) | ||
|
||
------ | ||
|
||
|
||
The following functions set lines, define formatting of the tooltip, its location and width: | ||
``` | ||
tooltips=layer_tooltips(variables) | ||
.format(field, format) | ||
.line(template) | ||
.anchor(position) | ||
.min_width(value) | ||
``` | ||
|
||
<a id="variables"></a> | ||
### Tooltip variable list: `layer_tooltips(variables = ['varName1', ... , 'varNameN'] )` | ||
The `variables` parameter defines a list of variable names, which values will be placed line by line in the general tooltip. | ||
If formatting is specified for a variable from this list (with the `format` function), it will be applied. | ||
Otherwise, the default formatting is used. | ||
Additional tooltip lines can be specified using the `line` functions. | ||
|
||
|
||
<a id="example-variables"></a> | ||
### Examples | ||
|
||
Set list of variables to place them in a multiline tooltip with the default formatting: | ||
|
||
``` | ||
ggplot(mpg) + geom_point(aes(x='displ', y='cty', fill='drv', size='hwy'), shape=21, color='black', | ||
tooltips=layer_tooltips(['manufacturer', 'model', 'class', 'drv'])) | ||
``` | ||
![](examples/images/tooltips_8.png) | ||
|
||
|
||
Define the format for the variable from the list and specify an additional line: | ||
``` | ||
ggplot(mpg) + geom_point(aes(x='displ', y='cty', fill='drv', size='hwy'), shape=21, color='black', | ||
tooltips=layer_tooltips(['manufacturer', 'model', 'class', 'drv']) | ||
.format('drv', '{}wd') | ||
.line('cty/hwy [mpg]|@cty/@hwy')) | ||
``` | ||
|
||
![](examples/images/tooltips_9.png) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters