Hello all,
I'm new to dygraph, and wondering how we can group in dygraph charts by one of the variable in the DF.
In my DF I have 2 columns (after converting to XTS, they are named as :
"..1","..2"
"..1"==> is the data of Y axis (or values)
"..2" ==> is the data that I want to group by
So I want each item in "..2" to have different color than the others:
I tried this code but it didn't color it:
dygraph(XTS_newData,ylab="Filtered KPI (The focus)",
main="Top HRs that had increment", group = "..2") %>%
dyOptions(colors = RColorBrewer::brewer.pal(10, "Paired")) %>%
dyRangeSelector() %>%
dyLegend(show = "follow", width = 400, showZeroValues = FALSE)
Then I minimized the data to
dygraph(XTS_newData,ylab="Filtered KPI (The focus)",
main="Top HRs that had increment", group = "..2")
And that didn't work too.
Finally I made the grouping by dplyr, before providing the data to dygraph, then also that didn't work because of the Error below:
///Error in UseMethod("group_by_") :
/// no applicable method for 'group_by_' applied to an object of class "c('xts', 'zoo')"
I checked the pdf file for the package and it didn't have enough Examples also same been found in the online help.
Any advice on how to use the grouping in the in dygraph chart will be really appreciated.
Thanks in advance.
Hassan Al Shekha.