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.- theme
Optional Theme, list, or
NA: The theme the option will be drawn with, as indraw(). Charts that compute colors before the widget exists read them from it: sign colors a config leaves unset, and the background a color scale fades to.NULLuses the built-in light and dark themes.- ...
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"