Skip to contents

Turns a ChartConfig into the backend option object draw() renders – an EChartsOption for ECharts charts. This is where a config's column names are resolved against actual data.

Usage

compile(config, data = NULL, ...)

Arguments

config

ChartConfig: The chart configuration.

data

Optional Data frame or named list: The data to plot. When NULL, the config's dat_path is read instead.

...

Passed to methods.

Value

Render option object, e.g. EChartsOption.

Details

The generic does the two steps every chart needs before its own translation can start, so that no method can forget one: it materializes the data (from data, or from the config's dat_path) and resolve()s the config against it. Methods therefore always receive a resolved config and non-NULL data, and are pure translation.

Author

EDG

Examples

config <- setup_ScatterConfig(x = "wt", y = "mpg")
option <- compile(config, data = mtcars)
option@x_axis@name
#> [1] "wt"