Enables or disables synchronized hover crosshair across linked charts.
Composable with linkCharts and setLinked via
the pipe: call after linking to opt into cursor sync without re-linking.
Preserves any existing interactions$linked configuration.
Arguments
- myIO
A myIO htmlwidget.
- enabled
Logical.
TRUEto turn cursor sync on,FALSEto turn it off. DefaultTRUE.- axis
Character. Which axis to sync:
"x"(default) draws a vertical rule at the hovered x value,"y"draws a horizontal rule at the hovered y value, and"xy"draws both. A rule is only drawn when the sibling chart can map the incoming value through its own scale, so a value outside the sibling's domain draws nothing on that axis.
Examples
# \donttest{
w1 <- myIO() |>
addIoLayer(type = "point", label = "a",
data = mtcars, mapping = list(x_var = "wt", y_var = "mpg"))
w2 <- myIO() |>
addIoLayer(type = "point", label = "b",
data = mtcars, mapping = list(x_var = "hp", y_var = "mpg"))
linked <- linkCharts(w1, w2, on = "cyl")
linked[[1]] <- setLinkedCursor(linked[[1]])
linked[[2]] <- setLinkedCursor(linked[[2]])
# }
