Skip to contents

Low-level function that takes an EChartsOption (or a plain list) and renders it as an interactive htmlwidget.

Usage

draw(
  option,
  theme = NULL,
  renderer = "canvas",
  width = NULL,
  height = NULL,
  elementId = NULL,
  filename = NULL,
  meta = list()
)

Arguments

option

EChartsOption or named list: Option object to render.

theme

Optional Theme, list, or NA: Theme override. NULL enables auto-detection of light/dark mode, or NA for no theme (raw ECharts defaults). When NULL, the widget detects dark mode from VS Code, RStudio, or the browser's prefers-color-scheme and applies theme_light() or theme_dark() accordingly.

renderer

Character {"canvas", "svg"}: Rendering engine.

width

Optional Character or Numeric: Widget width.

height

Optional Character or Numeric: Widget height.

elementId

Optional Character: Explicit element ID.

filename

Optional Character: If provided, the widget is also written to this file via save_drawing(). Extension determines the format (currently only .svg is supported).

meta

Optional named list: Extra fields merged into the widget payload. Used internally (e.g. by draw_heatmap() to pass square-cell layout parameters to the JS binding).

Value

htmlwidget: Widget object.