Edge363 Edge363 - 3 months ago 25
R Question

Creating negative stacking bar chart with Highcharter(Likert chart)

The dream is that Jkunst responds, but I am trying to create a negative stacking bar chart with highcharter like the highcharts demo here -http://jsfiddle.net/KV5KV/

I've tried swapping all of the options and what not, but I can't seem to get it to show more than one series at a time, if anybody can help it would be wonderful. Here is what I am trying to run in R.

highchart() %>%
hc_chart(type = "bar") %>%
hc_title(text = "stuff") %>%
hc_yAxis(title = list(text = ""),
labels = list(format = "{value}"), min=0) %>%
hc_plotOptions(column = list(
series=list(stacking='normal'),
dataLabels = list(enabled = FALSE),
enableMouseTracking = TRUE)) %>%
hc_legend(enabled = FALSE) %>%
hc_xAxis(reversed=FALSE,opposite=TRUE,reversed=FALSE, linkedTo=0) %>%
hc_series(list(name="Value",color=c("#766A62"),data=list(-10, -5, -6))) %>%
hc_add_series(list(name="Value",color=c("#766A62"),data=list(-2, -5, -3))) %>%
hc_add_series(list(name="neutral",id='neutral',color=c("#766A62"),data=list(-2, -5, -3))) %>%
hc_add_series(list(name="Value",color=c("#766A62"),data=list(5, 1,6))) %>%
hc_add_series(list(name="Value",color=c("#766A62"),data=list(2, 5, 3))) %>%
hc_add_series(list(linkedTo='neutral',name="neutral",color=c("#766A62"),data=list(6, 8, 2)))

Answer

I HAVE DONE IT.

highchart() %>% 
  hc_chart(type = "bar") %>% 
  hc_title(text = "Experimental Survey Questions breakdown") %>% 
  hc_yAxis(title = list(text = ""), 
           labels = list(format = "{value}")) %>% 
  hc_plotOptions(series=list(stacking='normal'),column = list( 
    dataLabels = list(enabled = FALSE), 
    enableMouseTracking = TRUE)) %>% 
  hc_legend(enabled = FALSE) %>% 
  hc_xAxis(reversed=FALSE,opposite=TRUE,reversed=FALSE) %>% 
  hc_add_series(name="Value",color=c("rgb(205,35,35)"),data=list(-10, -5, -6))    %>%
  hc_add_series(name="Values",color=c("rgb(165,85,85)"),data=list(-2, -5, -3))  %>%
  hc_add_series(name="neutral",id='neutral',color=c("#766A62"),data=list(-2, -5, -3))  %>%
  hc_add_series(name="Valuess",color=c("rgb(35,35,205)"),data=list(5, 1,6))  %>%
  hc_add_series(name="Valuesss",color=c("rgb(85,85,165)"),data=list(2, 5, 3))  %>%
  hc_add_series(name="Neutral",linkedTo='neutral',color=c("#766A62"),data=list(6, 8, 2))

^Cut and dry for those looking for answer, Special thanks to good ol jbkunst, he made this amazing library and has completely changed the way I present my research( you dah best they evah wuz ;)

I still have the question of how to get the actual values to link together(neutral has a line through it, which is lame.)

Comments