I am trying to convert my vertical stacked bar chart to a horizontal stacked bar chart, but I can not get the rotation to happen. I tried using hbar to create the rotation, but the chart still ends up staying in place. All tips appreciated!
from bokeh.charts import Bar, output_file, show, hplot
from bokeh.models import HoverTool, ColumnDataSource, Range1d, LabelSet, Label
# create data
data = {
'customer': ['Cust 1', 'Cust 2', 'Cust 1', 'Cust 3', 'Cust 1', 'Cust 2'],
'itemSold': ['python', 'python', 'pypy', 'pypy', 'jython', 'jython'],
'sales': [200, 600, 850, 620, 400, 550]
}
#create hover tooltip
hover = HoverTool(tooltips=[
("sales", "$sales"),
("customer", "@customer"),
("itemSold", "@itemSold")
])
# x-axis itemSold , stacking customer
bar = Bar(data, values='sales', label='itemSold', stack='customer',
title="Python itemSold Sampling", legend='top_right', sizing_mode = "scale_both", tools=[hover, 'wheel_zoom'])
bar.hbar(y = data['sales'], height=0.5, right = data['customer'])
output_file("stacked.html")
show(bar)