updated vignette sync charts

This commit is contained in:
pvictor 2021-01-06 10:29:34 +01:00
parent 4b82ddb922
commit 5dc9271701
1 changed files with 20 additions and 2 deletions

View File

@ -30,14 +30,30 @@ apex(
mapping = aes(x = date, y = pce),
type = "line",
synchronize = "economics"
)
) %>%
ax_yaxis(
decimalsInFloat = 0,
labels = list(
formatter = format_num("~s"),
minWidth = 40
)
) %>%
ax_tooltip(x = list(format = "yyyy"))
apex(
data = tail(economics, 150),
mapping = aes(x = date, y = psavert),
type = "line",
synchronize = "economics"
)
) %>%
ax_yaxis(
decimalsInFloat = 0,
labels = list(
formatter = format_num("~s"),
minWidth = 40
)
) %>%
ax_tooltip(x = list(format = "yyyy"))
```
@ -45,6 +61,8 @@ apex(
```
Note that you have to set a common `minWidth` for y axis labels. Different width yaxis in different charts will produce incorrect results when hovering or interacting.
For an example in Shiny, you can run: