Grouping in dygraph

103 views
Skip to first unread message

Hassan Al Shekha

unread,
Jan 20, 2016, 1:54:51 AM1/20/16
to dygraphs-users
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. 

Dan Vanderkam

unread,
Jan 20, 2016, 11:16:42 AM1/20/16
to dygraphs-users
This isn't really an R mailing list. You'll have better luck asking on Stack Overflow.

--
You received this message because you are subscribed to the Google Groups "dygraphs-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dygraphs-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages