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.
Arguments
- config
ChartConfig: The chart configuration.
- data
Optional Data frame or named list: The data to plot. When
NULL, the config'sdat_pathis 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.
Examples
config <- setup_ScatterConfig(x = "wt", y = "mpg")
option <- compile(config, data = mtcars)
option@x_axis@name#> [1] "wt"