{"action":"created","issue":{"url":"https://api.github.com/repos/jbkunst/highcharter/issues/156","repository_url":"https://api.github.com/repos/jbkunst/highcharter","labels_url":"https://api.github.com/repos/jbkunst/highcharter/issues/156/labels{/name}","comments_url":"https://api.github.com/repos/jbkunst/highcharter/issues/156/comments","events_url":"https://api.github.com/repos/jbkunst/highcharter/issues/156/events","html_url":"https://github.com/jbkunst/highcharter/issues/156","id":170058226,"number":156,"title":"Q: How to implement column chart with groupings?","user":{"login":"bogdanrau","id":7134642,"avatar_url":"https://avatars.githubusercontent.com/u/7134642?v=3","gravatar_id":"","url":"https://api.github.com/users/bogdanrau","html_url":"https://github.com/bogdanrau","followers_url":"https://api.github.com/users/bogdanrau/followers","following_url":"https://api.github.com/users/bogdanrau/following{/other_user}","gists_url":"https://api.github.com/users/bogdanrau/gists{/gist_id}","starred_url":"https://api.github.com/users/bogdanrau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bogdanrau/subscriptions","organizations_url":"https://api.github.com/users/bogdanrau/orgs","repos_url":"https://api.github.com/users/bogdanrau/repos","events_url":"https://api.github.com/users/bogdanrau/events{/privacy}","received_events_url":"https://api.github.com/users/bogdanrau/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/jbkunst/highcharter/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-08-09T00:45:37Z","updated_at":"2016-08-09T15:23:52Z","closed_at":null,"body":"Hi @jbkunst,\r\n\r\nI'm about 99.9% certain that this question is beyond basic, but I've exhausted all remaining ideas. I'm trying to get column groupings to work and can't seem to make it stick. What I'm trying to do is the following:\r\n\r\n```\r\n# Sample data\r\ndata <- data.frame(year = c(2011,2011,2012,2012,2013,2013),\r\n                   percent = c(10,12,13,12,13,14),\r\n                   label = c(\"ONE\", \"TWO\", \"ONE\", \"TWO\", \"ONE\", \"TWO\"))\r\n\r\n# This works as intended\r\nhchart(data, \"column\", x = label, y = percent, group = year)\r\n\r\n# I need to use highchart() instead of hchart() for further customizations, but I can't figure out how to get the grouping to work as well.\r\nhighchart() %>%\r\n  hc_xAxis(categories = data$label) %>%\r\n  hc_add_series(data = data$percent, type = \"column\") \r\n```\r\n\r\nAny insight on how to get groupings to work? I need to show error bars on each (coming from another column), which would likely be another hc_add_series...but I need to group them by year and by label first.\r\n\r\nThank you!\r\n\r\nBogdan"},"comment":{"url":"https://api.github.com/repos/jbkunst/highcharter/issues/comments/238588873","html_url":"https://github.com/jbkunst/highcharter/issues/156#issuecomment-238588873","issue_url":"https://api.github.com/repos/jbkunst/highcharter/issues/156","id":238588873,"user":{"login":"bogdanrau","id":7134642,"avatar_url":"https://avatars.githubusercontent.com/u/7134642?v=3","gravatar_id":"","url":"https://api.github.com/users/bogdanrau","html_url":"https://github.com/bogdanrau","followers_url":"https://api.github.com/users/bogdanrau/followers","following_url":"https://api.github.com/users/bogdanrau/following{/other_user}","gists_url":"https://api.github.com/users/bogdanrau/gists{/gist_id}","starred_url":"https://api.github.com/users/bogdanrau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bogdanrau/subscriptions","organizations_url":"https://api.github.com/users/bogdanrau/orgs","repos_url":"https://api.github.com/users/bogdanrau/repos","events_url":"https://api.github.com/users/bogdanrau/events{/privacy}","received_events_url":"https://api.github.com/users/bogdanrau/received_events","type":"User","site_admin":false},"created_at":"2016-08-09T15:23:52Z","updated_at":"2016-08-09T15:23:52Z","body":"Thank you for the suggestion @Yang-Tang! It seems like this solution is order-dependent. For example, running your suggestion results in an expected graph. However, switching the label categories around will shuffle the columns around:\r\n\r\n```\r\ndata <- data.frame(year = c(2011,2011,2012,2012,2013,2013),\r\n                   percent = c(10,12,13,12,13,14),\r\n                   label = c(\"ONE\", \"ONE\", \"TWO\", \"TWO\", \"THREE\", \"THREE\"))\r\n###### Notice the label column above is ordered differently\r\n\r\ndata_lst <- data %>% \r\n    group_by(year) %>% \r\n    do(data = list.parse2(.[, c('label', 'percent')])) %>% \r\n    rename(name = year) %>% \r\n    mutate(type = 'column') %>% \r\n    list.parse3()\r\n\r\nhighchart() %>%\r\n    hc_xAxis(categories = data$label) %>%\r\n    hc_add_series_list(data_lst)\r\n```\r\n Any insight? Happy to take this to stackoverflow if you want to keep your issues list clear of non-issues. \r\n\r\nThanks again for your help guys!\r\n\r\nBogdan"}}
{"actor":{"display_login":"bogdanrau"}}