Most of the time I user highcharter library to plot specific amount of time-series this way:
highchart() %>%
hc_add_series(name = "DF Column name", data = df$VALUE, color = ... ) %>%
hc_add_series(name = "DF Column name2", data = df$VALUE2, color = ... )
Sometimes however I don't know the amount of columns and their names in data frame - e.g. when the data frame is a result of dcast() function.
I would like the library to plot all of the columns, set series name as column names and assign colors from a default color-order pallette.
It is easily done using dygraphs library where I decide whether I want to specify the series myself or I want the library to do this for me:
Thank you for the link! It is a very good article showing how to use Highcharts documentation to create charts in R/Shiny.
It appears that while dygraphs library needs data in "wide" format, highcharter needs melted data ("long" format) to create dynamic number of plots.
Below is the solution I started to use after reading the article:
using reshape2::melt function as opposed to tidyr::gather suggested in the article
If your question's been answered (even by you!), would you mind choosing a solution? It helps other people see which questions still need help, or find solutions if they have similar problems. Here’s how to do it: