e_inspect {echarts4r} | R Documentation |
To & From JSON
Description
Get JSON options from an echarts4r object and build one from JSON.
Usage
e_inspect(e, json = FALSE, ...)
echarts_from_json(txt)
Arguments
e |
An |
json |
Whether to return the JSON, otherwise returns a |
... |
Additional options to pass to toJSON. |
txt |
JSON character string, url, or file. |
Details
txt
should contain the full list of options required to build a chart.
This is subsequently passed to the setOption
ECharts (JavaScript) function.
Value
e_inspect
Returns a list
if json
is FALSE
and a
JSON string otherwise. echarts_from_json
returns an object of class echarts4r
.
Note
Must be passed as last option.
Examples
p <- cars |>
e_charts(dist) |>
e_scatter(speed, symbol_size = 10)
p # plot
# extract the JSON
json <- p |>
e_inspect(
json = TRUE,
pretty = TRUE
)
# print json
json
# rebuild plot
echarts_from_json(json) |>
e_theme("dark") # modify
[Package echarts4r version 0.4.5 Index]