Time 带日期的bokeh面片堆叠面积图

Time 带日期的bokeh面片堆叠面积图,time,charts,bokeh,patch,Time,Charts,Bokeh,Patch,我在获取包含日期的堆积面积图时遇到问题。我遵循了位于以下位置的示例: 但是,此示例不填充数据。这是我的密码: data = {'A': {0: 30.0, 1: 40.0, 2: 39.0, 3: 30.0, 4: 21.0}, 'All': {0: 374.0, 1: 414.0, 2: 373.0, 3: 362.0, 4: 351.0}, 'B': {0: 237.0, 1: 246.0, 2: 216.0, 3: 187.0, 4: 202.0}, 'C': {0: 93.

我在获取包含日期的堆积面积图时遇到问题。我遵循了位于以下位置的示例:

但是,此示例不填充数据。这是我的密码:

    data = {'A': {0: 30.0, 1: 40.0, 2: 39.0, 3: 30.0, 4: 21.0},
 'All': {0: 374.0, 1: 414.0, 2: 373.0, 3: 362.0, 4: 351.0},
 'B': {0: 237.0, 1: 246.0, 2: 216.0, 3: 187.0, 4: 202.0},
 'C': {0: 93.0, 1: 120.0, 2: 103.0, 3: 136.0, 4: 118.0},
 'D': {0: 14.0, 1: 8.0, 2: 15.0, 3: 9.0, 4: 9.0},
 'DEPT': {0: 'All', 1: 'All', 2: 'All', 3: 'All', 4: 'All'},
 'E': {0: 0.0, 1: 0.0, 2: 0.0, 3: 0.0, 4: 1.0},
 'YEAR_WEEK': {0: '2017_01',
  1: '2017_02',
  2: '2017_03',
  3: '2017_04',
  4: '2017_05'}}

df_all = pd.DataFrame(data)

output_notebook()

def  stacked(df):
    df_top = df.cumsum(axis=1)
    df_bottom = df_top.shift(axis=1).fillna({'A': 0})[::-1]
    df_stack = pd.concat([df_bottom, df_top], ignore_index=True)
    return df_stack

areas = stacked(df_all[['A','D','B','C','E']])

colors = brewer['Spectral'][areas.shape[1]]

x2 = np.hstack((df_all.index[::-1], df_all.index))


source = ColumnDataSource(df_all)

"""This works and shows data but does not have date tag"""
p = figure()

"""This does not show data but chart does have date tag"""
# p = figure(x_range = FactorRange(factors = df_all.YEAR_WEEK.tolist()), y_range =(0,1200))

p.patches([x2] * areas.shape[1], [areas[c].values for c in areas],color=colors, alpha=0.8, line_color=None)


p.xaxis.major_label_orientation = 'vertical'

show(p)

已知Bokeh的当前版本存在以下问题: