Hello Everyone…I am facing some difficulty in source.trigger…Its not showing any error and showing a warning -ColumnDataSource’s columns must be of the same length. Current lengths: (‘x’, 0), (‘y’, 3)
Please help me out to solve this warning message
Here is the code :-
#importing numpy and pandas
import numpy as np
import pandas as pd
#importing Bokeh Library and files
from bokeh.io import show, output_file
from bokeh.io import curdoc
from bokeh.models import ColumnDataSource, Select
from bokeh.plotting import figure
from bokeh.layouts import layout, widgetbox, column, row, gridplot
from bokeh.models import HoverTool,LassoSelectTool,WheelZoomTool,BoxZoomTool,ResetTool,PanTool
from bokeh.palettes import GnBu3, OrRd3
from bokeh.plotting import reset_output
#defining source variable
source = ColumnDataSource({‘x’: , ‘y’: })
i=1
X=
def update():
global i
x=[2,3,4]
global X
X=[i*n for n in x]
print(X)
i=i/1.1
data2 = source.data
data2['y']= [0.5,1.5,2.5]
source.trigger('data',...,data2)
data1 = source.data
data1['x'] = X
source.trigger('data',...,data1)
curdoc().add_periodic_callback(update,10000)
#HORIZONTAL BAR PLOT
fig= figure(plot_width=1000,plot_height=300,x_axis_label=‘k’,title='Power ',toolbar_location=“above”,tools="")
fig.hbar(y=‘y’, right=‘x’,height=0.4,color=OrRd3[1],source=source)
curdoc().add_root(fig)
curdoc().title = “Live updating”