oidnChaRts is designed to support the following use cases:
You might find that the output of oidnChaRts is sufficiently useful for your visualisation needs, but it's specifically not designed to create an infinitely flexible manner to create chart X in different libraries - because that would be very difficult.
All good htmlwidget
libraries use the %>%
(pipe) operator to provide a consistent method to construct/add layers to charts. This is achieved by insisting on the first argument of most funtions being a htmlwidget of the kind you're building.
As an example, consider a htmlwidget
library called pokedexeR
which creates a display of your Pokémon data using the following functions:
pokedexeR
containing your Pokémon dataThese functions would be piped together as follows:
my_pokemon_data %>% pokedex() %>% pokedexRegion(region = "Kanto") %>% pokedexResolution(resolution = "160x144")
The functions in the oidnChaRts
library that output charts are specifically designed not to support this workflow, i.e. one cannot do the following:
## This will fail, please read the explanation above my_data %>% scatter_plot(library = "highcharter") %>% # function from oidnChaRts line_chart(library = "highcharter") %>% # function from oidnChaRts hc_tooltip(shared = TRUE) # function directly from highcharter
However, in general one can take the output of a oidnChaRts
function and use it within the htmlwidget library's own functions:
library(leaflet) data_geo_lines_plot %>% geo_lines_plot() %>% addMarkers(lat = 0, lng = 0, label = "Null Island!")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.