I am working in flexdashboards
using rbokeh
to create dynamic interactive graphs and charts on a series of health related dashboards.
My current dilemma revolves around adding a line to a stacked bar chart with mapped color values and having it show up in the legend.
That bar chart is working flawlessly.
But when I add a pair of ab-lines to separate regions of the x-axis where a change in methods of collection occur, I cannot find a way to get the line to show up in the mapped legend.
Any attempt to coerce it returns NO CHART at all...
Completely stumped and would love some help!
CODE:
figure(title= "Confirmed & Probable Cases by Year",tools =c("pan","box_zoom", "reset", "save"), width= 1650, height =950, legend_location='top_left',toolbar_location = "above")%>%
ly_bar(x=Year, y= count, position='stack', data=probConf, width=.9, hover=TRUE, legend=TRUE, fill_alpha=.7, color=Classification) %>%
ly_abline(v=17.5, color = "red", width =1, alpha=.7)%>%
ly_abline(v=13.5, color = "red", width =1, alpha=.7, legend ="Change in Case Definition")%>%
set_palette(discrete_color = pal_color(c( "#336699","#339999")))%>%
x_axis(label ='Year', grid=FALSE)%>%
y_axis(label ='Cases',grid=FALSE)
With this: , legend ="Change in Case Definition"
in there, I get NO CHART at all, just white.
With ly_abline(v=13.5, color = "red", width =1, alpha=.7)%>%
I get a nice chart with no lines on the legend, as in the photograph below.
With: ly_abline(v=13.5, color = "red", width =1, alpha=.7, legend = TRUE)%>%
I get no chart at all (but no error code, just a vast expanse of white)