| Title: | Interactive Data Visualizations Using 'd3.js' |
|---|---|
| Description: | Create interactive 'd3.js' visualizations from R with built-in statistical transforms. Computes confidence intervals, regression fits, LOESS smoothing, moving averages, error bars, and uncertainty visualizations (quantile dot plots and fan charts) in R and renders them as composable chart layers via 'htmlwidgets'. Supports 36 chart types including boxplots, violin plots, Q-Q diagnostic plots, calendar heatmaps, survival curves, and group comparisons with pairwise significance testing. Also provides a machine-readable chart specification schema with validators so that large language model agents can author and verify charts. Works in 'RStudio', 'Shiny', and 'R Markdown'. |
| Authors: | Ryan Morton [aut, cre, cph], Mike Bostock [cph] (D3.js, d3-hexbin, and d3-sankey libraries), James Hall [cph] (jsPDF library), yWorks GmbH [cph] (jsPDF library) |
| Maintainer: | Ryan Morton <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 1.2.0 |
| Built: | 2026-06-11 18:31:03 UTC |
| Source: | https://github.com/cran/myIO |
Adds individual layer to a myIO widget
addIoLayer( myIO, type, color = NULL, label, data = NULL, mapping, transform = "identity", options = list(barSize = "large", toolTipOptions = list(suppressY = FALSE)) )addIoLayer( myIO, type, color = NULL, label, data = NULL, mapping, transform = "identity", options = list(barSize = "large", toolTipOptions = list(suppressY = FALSE)) )
myIO |
an htmlwidget object created by the |
type |
chart type |
color |
optional CSS color string or vector for grouped layers |
label |
unique layer label |
data |
data frame backing the layer |
mapping |
named aesthetic mapping list |
transform |
transform name applied before serialization |
options |
layer options passed through to the widget config |
A modified myIO htmlwidget object with the new layer appended
to the configuration.
myIO(data = mtcars) |> addIoLayer( type = "point", label = "points", mapping = list(x_var = "wt", y_var = "mpg") )myIO(data = mtcars) |> addIoLayer( type = "point", label = "points", mapping = list(x_var = "wt", y_var = "mpg") )
Remove DuckDB-WASM cache entries
clear_duckdb_wasm_cache(version = NULL)clear_duckdb_wasm_cache(version = NULL)
version |
Character scalar naming a specific version to remove. If NULL, removes all cached versions. |
Number of removed entries, invisibly.
## Not run: # Removes cached DuckDB-WASM binaries from the user cache. clear_duckdb_wasm_cache() ## End(Not run)## Not run: # Removes cached DuckDB-WASM binaries from the user cache. clear_duckdb_wasm_cache() ## End(Not run)
Function to define the x variable as categorical
defineCategoricalAxis(myIO, xAxis = TRUE, yAxis = FALSE)defineCategoricalAxis(myIO, xAxis = TRUE, yAxis = FALSE)
myIO |
an htmlwidget object created by the myIO() function |
xAxis |
a logical argument (TRUE) for defining the x axis as categorical |
yAxis |
a logical argument (TRUE) for defining the y axis as categorical |
A modified myIO htmlwidget object with categorical axis
configured.
# Define x axis as categorical myIO() |> defineCategoricalAxis(xAxis = TRUE) # Define both axes as categorical myIO() |> defineCategoricalAxis(xAxis = TRUE, yAxis = TRUE)# Define x axis as categorical myIO() |> defineCategoricalAxis(xAxis = TRUE) # Define both axes as categorical myIO() |> defineCategoricalAxis(xAxis = TRUE, yAxis = TRUE)
Function to make points draggable
dragPoints(myIO, dragPoints = TRUE)dragPoints(myIO, dragPoints = TRUE)
myIO |
an htmlwidget object created by the myIO() function |
dragPoints |
a logical argument (TRUE) for creating draggable points |
A modified myIO htmlwidget object with drag interaction
enabled.
# Enable draggable points myIO() |> addIoLayer( type = "point", color = "red", label = "pts", data = mtcars, mapping = list(x_var = "wt", y_var = "mpg") ) |> dragPoints()# Enable draggable points myIO() |> addIoLayer( type = "point", color = "red", label = "pts", data = mtcars, mapping = list(x_var = "wt", y_var = "mpg") ) |> dragPoints()
DuckDB-WASM cache status
duckdb_wasm_status()duckdb_wasm_status()
A list with class 'myIO_duckdb_wasm_status' and fields 'installed' (logical), 'version' (chr or NA), 'cache_dir' (chr), 'size_bytes' (numeric).
duckdb_wasm_status()duckdb_wasm_status()
Function to flip the x and y axes
flipAxis(myIO, flipAxis = TRUE)flipAxis(myIO, flipAxis = TRUE)
myIO |
an htmlwidget object created by the myIO() function |
flipAxis |
a logical argument (TRUE) for flipping the x and y axes |
A modified myIO htmlwidget object with axes flipped.
# Flip the axes for a horizontal bar chart myIO() |> addIoLayer( type = "bar", color = "steelblue", label = "bars", data = mtcars, mapping = list(x_var = "wt", y_var = "mpg") ) |> flipAxis()# Flip the axes for a horizontal bar chart myIO() |> addIoLayer( type = "bar", color = "steelblue", label = "bars", data = mtcars, mapping = list(x_var = "wt", y_var = "mpg") ) |> flipAxis()
Downloads and verifies the DuckDB-WASM runtime into a user-local cache so the in-browser big-data engine is available for subsequent widgets. This follows the keras3 / torch / reticulate pattern: the binary is NOT bundled with the R package and is not required for small-data use.
install_duckdb_wasm( version = NULL, from = NULL, force = FALSE, quiet = !interactive() )install_duckdb_wasm( version = NULL, from = NULL, force = FALSE, quiet = !interactive() )
version |
Character scalar naming the version to install. Defaults to the latest row in 'inst/duckdb-wasm-manifest.csv'. |
from |
Optional local directory containing pre-downloaded binaries ('duckdb-mvp.wasm' and 'duckdb-browser-mvp.worker.js'). Airgap path. |
force |
Logical. If TRUE, overwrite existing cached binaries. |
quiet |
Logical. Suppress progress output. Defaults to '!interactive()'. |
Invisibly returns the cache path where the binary was installed.
## Not run: # Downloads ~22 MB from the upstream mirror into the user cache. install_duckdb_wasm() ## End(Not run)## Not run: # Downloads ~22 MB from the upstream mirror into the user cache. install_duckdb_wasm() ## End(Not run)
A convenience wrapper that sets matching link config on multiple widgets
so that brush selections propagate between them. Unlike setLinked,
this does not require Crosstalk — it uses a shared group identifier and key
column to coordinate selections across charts rendered in the same page.
linkCharts(..., on, group = NULL, cursor = FALSE, cursorAxis = "x")linkCharts(..., on, group = NULL, cursor = FALSE, cursorAxis = "x")
... |
myIO widget objects to link. |
on |
Character. Column name to match rows across charts. |
group |
Character. Group identifier. Default auto-generated. |
cursor |
Logical. When |
cursorAxis |
Character. Which axis to sync: |
A list of modified myIO widgets with matching link config.
w1 <- myIO() |> addIoLayer(type = "point", label = "scatter", data = mtcars, mapping = list(x_var = "wt", y_var = "mpg")) w2 <- myIO() |> addIoLayer(type = "bar", label = "bars", data = mtcars, mapping = list(x_var = "cyl", y_var = "mpg")) linked <- linkCharts(w1, w2, on = "cyl")w1 <- myIO() |> addIoLayer(type = "point", label = "scatter", data = mtcars, mapping = list(x_var = "wt", y_var = "mpg")) w2 <- myIO() |> addIoLayer(type = "bar", label = "bars", data = mtcars, mapping = list(x_var = "cyl", y_var = "mpg")) linked <- linkCharts(w1, w2, on = "cyl")
Create an interactive D3.js chart widget
myIO( data = NULL, width = "100%", height = "400px", elementId = NULL, title = NULL, sparkline = FALSE, engine = "auto", webgl_threshold = 50000L, unify_data_path = FALSE )myIO( data = NULL, width = "100%", height = "400px", elementId = NULL, title = NULL, sparkline = FALSE, engine = "auto", webgl_threshold = 50000L, unify_data_path = FALSE )
data |
an optional point of entry for the data frame or vector |
width |
a string of either pixel width or a percentage width |
height |
a string of pixel height |
elementId |
a unique id for the htmlwidget object |
title |
Optional chart title rendered inside the widget SVG. |
sparkline |
Logical. If TRUE, renders a compact sparkline suitable for embedding in table cells. Strips axes, legend, and interactions. Only "line", "bar", and "area" layer types are supported. Default FALSE. |
engine |
one of |
webgl_threshold |
Positive integer row-count threshold for the big-data
WebGL render path. Use |
unify_data_path |
Logical. If TRUE, coordinator results also replace SVG
layer data below |
An htmlwidget object of class myIO.
myIO(data = mtcars) |> setMargin(top = 40, bottom = 80, left = 60, right = 10)myIO(data = mtcars) |> setMargin(top = 40, bottom = 80, left = 60, right = 10)
Get myIO Chart Schema for LLM Tool Calling
myio_chart_schema(type = NULL)myio_chart_schema(type = NULL)
type |
Optional chart type. When |
A list containing one chart schema or all chart schemas.
myio_chart_schema("boxplot")myio_chart_schema("boxplot")
Get a myIO Function Signature for LLM Tool Calling
myio_function_signature(fn = NULL)myio_function_signature(fn = NULL)
fn |
Optional exported function name. When |
A character vector of argument names or a named list of signatures.
myio_function_signature("setAxisFormat")myio_function_signature("setAxisFormat")
Prints guidance on how to find the most recent JavaScript error from a myIO widget. In Shiny, errors are available as reactive inputs. Outside Shiny, errors appear in the browser's developer console.
myIO_last_error(outputId = NULL)myIO_last_error(outputId = NULL)
outputId |
optional Shiny output ID (character string). If provided, prints the exact Shiny input key to read. |
Invisibly returns NULL. Called for its side effect
(printing diagnostic guidance).
myIO_last_error() myIO_last_error("chart1")myIO_last_error() myIO_last_error("chart1")
Returns chart type names from the generated myIO schema.
myio_list_chart_types()myio_list_chart_types()
A character vector of chart type names.
head(myio_list_chart_types())head(myio_list_chart_types())
List myIO Functions for LLM Tool Calling
myio_list_functions()myio_list_functions()
A character vector of exported myIO function names.
head(myio_list_functions())head(myio_list_functions())
Validate a myIO Function Call
myio_validate_call(fn, args = list())myio_validate_call(fn, args = list())
fn |
Exported myIO function name. |
args |
Named list of proposed arguments. |
A list with valid and errors. Errors use stable
machine-readable code values.
myio_validate_call("setAxisFormat", list(axis_x = ".0f"))myio_validate_call("setAxisFormat", list(axis_x = ".0f"))
Validates a proposed chart specification against the generated myIO schema.
myio_validate_spec(spec, columns = NULL)myio_validate_spec(spec, columns = NULL)
spec |
A list with |
columns |
Optional named column type map. When supplied, overrides
|
A list with valid and errors. Errors use stable
machine-readable code values.
myio_validate_spec(list( type = "boxplot", mapping = list(column_var = "Species", value_var = "Sepal.Width") ))myio_validate_spec(list( type = "boxplot", mapping = list(column_var = "Species", value_var = "Sepal.Width") ))
Shiny Bindings for myIO
myIOOutput(outputId, width = "100%", height = "400px") renderMyIO(expr, env = parent.frame(), quoted = FALSE)myIOOutput(outputId, width = "100%", height = "400px") renderMyIO(expr, env = parent.frame(), quoted = FALSE)
outputId |
output variable to read from |
width, height
|
Must be a valid CSS unit or a number. |
expr |
An expression that generates a myIO |
env |
The environment in which to evaluate |
quoted |
Is |
myIOOutput returns a Shiny UI element for placement in a UI
definition. renderMyIO returns a Shiny render function for use in a
server definition.
if (interactive()) { library(shiny) ui <- fluidPage(myIOOutput("chart")) server <- function(input, output) { output$chart <- renderMyIO({ myIO(data = mtcars) |> addIoLayer(type = "point", label = "scatter", mapping = list(x_var = "wt", y_var = "mpg")) }) } shinyApp(ui, server) }if (interactive()) { library(shiny) ui <- fluidPage(myIOOutput("chart")) server <- function(input, output) { output$chart <- renderMyIO({ myIO(data = mtcars) |> addIoLayer(type = "point", label = "scatter", mapping = list(x_var = "wt", y_var = "mpg")) }) } shinyApp(ui, server) }
Enables annotation mode where clicking a data point opens a label input. Annotations are stored as data and can be exported or accessed as a Shiny reactive input.
setAnnotation(myIO, labels = NULL, colors = NULL, mode = "click")setAnnotation(myIO, labels = NULL, colors = NULL, mode = "click")
myIO |
an htmlwidget object created by the |
labels |
character vector of preset label options (optional). If provided, shows a dropdown instead of free-text input. |
colors |
named character vector of category colors (optional). Names are category labels, values are CSS colors. |
mode |
|
A modified myIO htmlwidget object with annotation enabled.
myIO(data = mtcars) |> addIoLayer( type = "point", label = "pts", mapping = list(x_var = "wt", y_var = "mpg") ) |> setAnnotation(labels = c("outlier", "normal"))myIO(data = mtcars) |> addIoLayer( type = "point", label = "pts", mapping = list(x_var = "wt", y_var = "mpg") ) |> setAnnotation(labels = c("outlier", "normal"))
Sets axis for x axis, y axis, and/or tool tip
setAxisFormat( myIO, xAxis = NULL, yAxis = NULL, toolTip = NULL, xLabel = NULL, yLabel = NULL )setAxisFormat( myIO, xAxis = NULL, yAxis = NULL, toolTip = NULL, xLabel = NULL, yLabel = NULL )
myIO |
an htmlwidget object created by the myIO() function |
xAxis |
Optional string indicating a d3.js format for the x axis.
When |
yAxis |
Optional string indicating a d3.js format for the y axis.
When |
toolTip |
Optional string indicating a d3.js format for tooltips.
When |
xLabel |
Optional string label for the x axis. When |
yLabel |
Optional string label for the y axis. When |
A modified myIO htmlwidget object with updated axis format
configuration. with options set for the tooltip formats
# Set axis formats using d3.js format strings myIO() |> setAxisFormat(xAxis = ".0f", yAxis = ".1f") # Set axis labels myIO() |> setAxisFormat(xLabel = "Weight (lbs)", yLabel = "MPG") # Label-only calls preserve previously configured formats myIO() |> setAxisFormat(yAxis = ".2f") |> setAxisFormat(yLabel = "Rate")# Set axis formats using d3.js format strings myIO() |> setAxisFormat(xAxis = ".0f", yAxis = ".1f") # Set axis labels myIO() |> setAxisFormat(xLabel = "Weight (lbs)", yLabel = "MPG") # Label-only calls preserve previously configured formats myIO() |> setAxisFormat(yAxis = ".2f") |> setAxisFormat(yLabel = "Rate")
Sets the minimum and maximum values for chart axes
setAxisLimits( myIO, xlim = list(min = NULL, max = NULL), ylim = list(min = NULL, max = NULL) )setAxisLimits( myIO, xlim = list(min = NULL, max = NULL), ylim = list(min = NULL, max = NULL) )
myIO |
an htmlwidget object created by the myIO() function |
xlim |
a list of min and max values |
ylim |
a list of min and max values |
A modified myIO htmlwidget object with updated axis limits.
# Set x axis limits myIO() |> setAxisLimits(xlim = list(min = 0, max = 100)) # Set both axis limits myIO() |> setAxisLimits( xlim = list(min = 0, max = 50), ylim = list(min = -10, max = 200) )# Set x axis limits myIO() |> setAxisLimits(xlim = list(min = 0, max = 100)) # Set both axis limits myIO() |> setAxisLimits( xlim = list(min = 0, max = 50), ylim = list(min = -10, max = 200) )
'setBigData()' declares the data source that a myIO widget should use for large-dataset rendering and linked-selection coordination.
setBigData(widget, source, rowkey_col = NULL, ...)setBigData(widget, source, rowkey_col = NULL, ...)
widget |
A myIO htmlwidget object. |
source |
A supported big-data source: a 'data.frame', an Arrow table or record-batch reader, a single file path or URL ending in '.parquet', '.arrow', '.feather', or '.csv', or a 'DBIConnection'. |
rowkey_col |
Optional name of the column that uniquely identifies rows for Crosstalk-compatible linked selections. |
... |
Additional source-specific options. For DBI sources, pass 'table = "name"' so myIO can query the table schema. For file path or URL sources, pass 'schema = c("col1", "col2", ...)' or a schema field list. |
This function writes the 'x.bigdata.*' payload fields consumed by the widget's large-dataset virtualization path and follows its row-key contract. DBI sources are stored as an internal session-scoped marker in 'x.bigdata$dbi_handle_internal'; render-time source registration is handled by the source registry phase.
A modified myIO htmlwidget object.
myIO(data = mtcars) |> setBigData(mtcars) myIO() |> setBigData("data/large.parquet", schema = c("id", "x", "y"), rowkey_col = "id") if (requireNamespace("duckdb", quietly = TRUE)) { con <- DBI::dbConnect(duckdb::duckdb()) obs <- data.frame(id = seq_len(nrow(mtcars)), mpg = mtcars$mpg) DBI::dbWriteTable(con, "observations", obs) myIO() |> setBigData(con, table = "observations", rowkey_col = "id") DBI::dbDisconnect(con, shutdown = TRUE) }myIO(data = mtcars) |> setBigData(mtcars) myIO() |> setBigData("data/large.parquet", schema = c("id", "x", "y"), rowkey_col = "id") if (requireNamespace("duckdb", quietly = TRUE)) { con <- DBI::dbConnect(duckdb::duckdb()) obs <- data.frame(id = seq_len(nrow(mtcars)), mpg = mtcars$mpg) DBI::dbWriteTable(con, "observations", obs) myIO() |> setBigData(con, table = "observations", rowkey_col = "id") DBI::dbDisconnect(con, shutdown = TRUE) }
Enables rectangle brush selection on the chart. When a user drags to select a region, the selected data points are available as a reactive input in Shiny or exportable in static HTML.
setBrush(myIO, direction = "xy", on_select = "highlight")setBrush(myIO, direction = "xy", on_select = "highlight")
myIO |
an htmlwidget object created by the |
direction |
brush direction: |
on_select |
behavior in static mode: |
A modified myIO htmlwidget object with brush interaction
enabled.
myIO(data = mtcars) |> addIoLayer( type = "point", label = "pts", mapping = list(x_var = "wt", y_var = "mpg") ) |> setBrush()myIO(data = mtcars) |> addIoLayer( type = "point", label = "pts", mapping = list(x_var = "wt", y_var = "mpg") ) |> setBrush()
Sets color scheme for a chart and the category names (optional)
setColorScheme(myIO, colorScheme = NULL, setCategories = NULL)setColorScheme(myIO, colorScheme = NULL, setCategories = NULL)
myIO |
an htmlwidget object created by the myIO() function |
colorScheme |
a vector of colors in the order you want them used |
setCategories |
an optional vector of names that will be mapped to the corresponding color in the colorScheme |
A modified myIO htmlwidget object with updated color scheme.
# Set a custom color scheme myIO() |> setColorScheme(colorScheme = list("red", "blue", "green")) # Set colors with category labels myIO() |> setColorScheme( colorScheme = list("steelblue", "orange"), setCategories = c("Group A", "Group B") )# Set a custom color scheme myIO() |> setColorScheme(colorScheme = list("red", "blue", "green")) # Set colors with category labels myIO() |> setColorScheme( colorScheme = list("steelblue", "orange"), setCategories = c("Group A", "Group B") )
Controls which export buttons appear in the chart toolbar.
setExportOptions( myIO, png = TRUE, svg = TRUE, pdf = TRUE, clipboard = TRUE, csv = TRUE, title = NULL )setExportOptions( myIO, png = TRUE, svg = TRUE, pdf = TRUE, clipboard = TRUE, csv = TRUE, title = NULL )
myIO |
A myIO widget object. |
png |
Logical. Show PNG download button. Default TRUE. |
svg |
Logical. Show SVG download button. Default TRUE. |
pdf |
Logical. Show PDF download button. Default TRUE. |
clipboard |
Logical. Show clipboard copy button. Default TRUE. |
csv |
Logical. Show CSV export button. Default TRUE. |
title |
Character or NULL. Chart title for PDF metadata. |
Modified myIO widget.
myIO(iris) |> addIoLayer("point", label = "pts", mapping = list(x_var = "Sepal.Length", y_var = "Sepal.Width")) |> setExportOptions(svg = TRUE, clipboard = TRUE, pdf = FALSE)myIO(iris) |> addIoLayer("point", label = "pts", mapping = list(x_var = "Sepal.Length", y_var = "Sepal.Width")) |> setExportOptions(svg = TRUE, clipboard = TRUE, pdf = FALSE)
Splits the chart into a grid of panels, one per unique value of the faceting variable. Each panel shows the same layers filtered to that subset of the data.
setFacet( myIO, var, ncol = NULL, min_width = 200, scales = "fixed", label_position = "top" )setFacet( myIO, var, ncol = NULL, min_width = 200, scales = "fixed", label_position = "top" )
myIO |
A myIO widget object. |
var |
Character. Column name to facet by. Must exist in at least one layer's data. |
ncol |
Integer or NULL. Number of columns in the grid. If NULL,
auto-computes from |
min_width |
Numeric. Minimum panel width in pixels when |
scales |
Character. Scale sharing mode:
|
label_position |
Character. Where to show panel labels:
|
Modified myIO widget.
myIO(iris) |> addIoLayer("point", label = "pts", mapping = list(x_var = "Sepal.Length", y_var = "Sepal.Width")) |> setFacet("Species", ncol = 3)myIO(iris) |> addIoLayer("point", label = "pts", mapping = list(x_var = "Sepal.Length", y_var = "Sepal.Width")) |> setFacet("Species", ncol = 3)
Set Layer Opacity
setLayerOpacity(myIO, label, opacity)setLayerOpacity(myIO, label, opacity)
myIO |
an htmlwidget object created by the myIO() function |
label |
character. The layer label to target. |
opacity |
numeric. Opacity value between 0 (transparent) and 1 (opaque). |
A modified myIO htmlwidget object.
myIO(iris) |> addIoLayer("point", label = "pts", mapping = list(x_var = "Sepal.Length", y_var = "Sepal.Width")) |> setLayerOpacity("pts", 0.5)myIO(iris) |> addIoLayer("point", label = "pts", mapping = list(x_var = "Sepal.Length", y_var = "Sepal.Width")) |> setLayerOpacity("pts", 0.5)
Connects the chart to a Crosstalk SharedData object so that brush selections propagate to other linked widgets.
setLinked( myIO, shared_data, mode = "both", filter = FALSE, key = NULL, group = NULL, cursor = FALSE, cursorAxis = "x" )setLinked( myIO, shared_data, mode = "both", filter = FALSE, key = NULL, group = NULL, cursor = FALSE, cursorAxis = "x" )
myIO |
an htmlwidget object created by the |
shared_data |
a |
mode |
|
filter |
if |
key |
Optional character vector of row keys. When supplied, overrides
the keys extracted from |
group |
Optional character string. When supplied, overrides the
Crosstalk group name from |
cursor |
Logical. When |
cursorAxis |
Character. Which axis to sync: |
A modified myIO htmlwidget with Crosstalk linking.
if (interactive() && requireNamespace("crosstalk", quietly = TRUE)) { shared <- crosstalk::SharedData$new(mtcars, key = ~rownames(mtcars)) myIO() |> addIoLayer( type = "point", label = "scatter", data = shared$data(), mapping = list(x_var = "wt", y_var = "mpg") ) |> setLinked(shared) }if (interactive() && requireNamespace("crosstalk", quietly = TRUE)) { shared <- crosstalk::SharedData$new(mtcars, key = ~rownames(mtcars)) myIO() |> addIoLayer( type = "point", label = "scatter", data = shared$data(), mapping = list(x_var = "wt", y_var = "mpg") ) |> setLinked(shared) }
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.
setLinkedCursor(myIO, enabled = TRUE, axis = "x")setLinkedCursor(myIO, enabled = TRUE, axis = "x")
myIO |
A myIO htmlwidget. |
enabled |
Logical. |
axis |
Character. Which axis to sync: |
A modified myIO htmlwidget.
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]])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]])
Sets margins for the top, bottom, left, and right sides of the chart
setMargin(myIO, top = 20, bottom = 40, left = 50, right = 50)setMargin(myIO, top = 20, bottom = 40, left = 50, right = 50)
myIO |
an htmlwidget object created by the myIO() function |
top |
a numeric value representing in pixels the top margin |
bottom |
a numeric value representing in pixels the bottom margin |
left |
a numeric value representing in pixels the left margin |
right |
a numeric value representing in pixels the right margin |
A modified myIO htmlwidget object with updated margin
configuration.
# Set custom margins myIO() |> setMargin(top = 50, bottom = 80, left = 60, right = 20)# Set custom margins myIO() |> setMargin(top = 50, bottom = 80, left = 60, right = 20)
Sets x and y reference lines
setReferenceLines(myIO, xRef = 0, yRef = 0)setReferenceLines(myIO, xRef = 0, yRef = 0)
myIO |
an htmlwidget object created by the myIO() function |
xRef |
a list of the reference line value of x |
yRef |
a list of the reference line value of y |
A modified myIO htmlwidget object with reference lines added.
# Add reference lines at x=5 and y=20 myIO() |> setReferenceLines(xRef = 5, yRef = 20)# Add reference lines at x=5 and y=20 myIO() |> setReferenceLines(xRef = 5, yRef = 20)
Adds a slider control below the chart that adjusts a transform option and triggers reactive re-rendering in Shiny.
setSlider(myIO, param, label, min, max, value, step = NULL, debounce = 200)setSlider(myIO, param, label, min, max, value, step = NULL, debounce = 200)
myIO |
an htmlwidget object created by the |
param |
transform option name (e.g., |
label |
display label for the slider |
min |
minimum value |
max |
maximum value |
value |
default value |
step |
step size (default: |
debounce |
debounce delay in milliseconds (default: 200) |
A modified myIO htmlwidget with slider config attached.
## Not run: # In a Shiny server function: output$chart <- renderMyIO({ myIO(data = mtcars) |> addIoLayer( type = "regression", label = "fit", mapping = list(x_var = "wt", y_var = "mpg"), options = list(ci_level = 0.95) ) |> setSlider("ci_level", "Confidence level", 0.80, 0.99, 0.95, 0.01) }) ## End(Not run)## Not run: # In a Shiny server function: output$chart <- renderMyIO({ myIO(data = mtcars) |> addIoLayer( type = "regression", label = "fit", mapping = list(x_var = "wt", y_var = "mpg"), options = list(ci_level = 0.95) ) |> setSlider("ci_level", "Confidence level", 0.80, 0.99, 0.95, 0.01) }) ## End(Not run)
Sets chart theme tokens using CSS custom properties
setTheme( myIO, text_color = NULL, grid_color = NULL, bg = NULL, font = NULL, mode = NULL, preset = NULL, overrides = list(), ... )setTheme( myIO, text_color = NULL, grid_color = NULL, bg = NULL, font = NULL, mode = NULL, preset = NULL, overrides = list(), ... )
myIO |
an htmlwidget object created by the myIO() function |
text_color |
text and label color |
grid_color |
grid line color |
bg |
background color |
font |
font family |
mode |
Character or NULL. Theme mode: "light", "dark", or "auto". Default NULL (no mode, manual CSS vars only). |
preset |
Character or NULL. Named preset (reserved for future use). Default NULL. |
overrides |
Named list of CSS custom property overrides
(e.g., |
... |
additional CSS custom property overrides with '–' prefix |
A modified myIO htmlwidget object with updated theme
configuration.
myIO() |> setTheme(text_color = "#222222", grid_color = "#d9d9d9") myIO() |> setTheme(mode = "dark", bg = "#1a1a2e")myIO() |> setTheme(text_color = "#222222", grid_color = "#d9d9d9") myIO() |> setTheme(mode = "dark", bg = "#1a1a2e")
Sets the title rendered inside the myIO widget SVG.
setTitle(myIO, title = NULL)setTitle(myIO, title = NULL)
myIO |
A myIO widget object. |
title |
Character title or NULL to remove the title. |
A modified myIO htmlwidget object.
myIO() |> setTitle("Miles per gallon") |> addIoLayer("point", label = "cars", data = mtcars, mapping = list(x_var = "wt", y_var = "mpg"))myIO() |> setTitle("Miles per gallon") |> addIoLayer("point", label = "cars", data = mtcars, mapping = list(x_var = "wt", y_var = "mpg"))
Sets toggle options for y_var and adds a toggle button for chart
setToggle(myIO, variable, format = NULL)setToggle(myIO, variable, format = NULL)
myIO |
an htmlwidget object created by the myIO() function |
variable |
a string indicating the variable name in data for toggle |
format |
a string indicating the format for the toggled variable |
A modified myIO htmlwidget object with toggle interaction
configured.
# Add a toggle button to switch y variable myIO() |> setToggle(variable = "Percent", format = ".0%")# Add a toggle button to switch y variable myIO() |> setToggle(variable = "Percent", format = ".0%")
Generic function for setting tool tip options for a chart
setToolTipOptions(myIO, suppressY = NULL)setToolTipOptions(myIO, suppressY = NULL)
myIO |
an htmlwidget object created by the myIO() function |
suppressY |
a boolean |
A modified myIO htmlwidget object with updated tooltip
options.
# Suppress the y value in tooltips myIO() |> setToolTipOptions(suppressY = TRUE)# Suppress the y value in tooltips myIO() |> setToolTipOptions(suppressY = TRUE)
Sets transition speeds across the chart (set to 0 to suppress)
setTransitionSpeed(myIO, speed)setTransitionSpeed(myIO, speed)
myIO |
an htmlwidget object created by the myIO() function |
speed |
a number indicating the speed of transition in milliseconds |
A modified myIO htmlwidget object with updated transition
speed.
# Set transition speed to 500ms myIO() |> setTransitionSpeed(speed = 500) # Disable transitions myIO() |> setTransitionSpeed(speed = 0)# Set transition speed to 500ms myIO() |> setTransitionSpeed(speed = 500) # Disable transitions myIO() |> setTransitionSpeed(speed = 0)
Suppresses axes from printing
suppressAxis(myIO, xAxis = NULL, yAxis = NULL)suppressAxis(myIO, xAxis = NULL, yAxis = NULL)
myIO |
an htmlwidget object created by the myIO() function |
xAxis |
a logical operator defining whether the x axis should be printed or not |
yAxis |
a logical operator defining whether the y axis should be printed or not |
A modified myIO htmlwidget object with axis display
suppressed.
# Suppress both axes myIO() |> suppressAxis(xAxis = TRUE, yAxis = TRUE) # Suppress only the x axis myIO() |> suppressAxis(xAxis = TRUE)# Suppress both axes myIO() |> suppressAxis(xAxis = TRUE, yAxis = TRUE) # Suppress only the x axis myIO() |> suppressAxis(xAxis = TRUE)
Suppresses legend from printing
suppressLegend(myIO, suppressLegend = TRUE)suppressLegend(myIO, suppressLegend = TRUE)
myIO |
an htmlwidget object created by the myIO() function |
suppressLegend |
a logical operator defining whether the legend should be printed or not |
A modified myIO htmlwidget object with legend display
suppressed.
# Hide the legend myIO() |> suppressLegend()# Hide the legend myIO() |> suppressLegend()