Hey Everybody .
I have some trouble by updating my ColumnDataSource. I don’t get what I’m doing wrong. I guess a beginner mistake . I just don’t
get it alone. Every advice will be veryyy helpfull .
What happened is : I get the plot done and I can update one time with one value of the select widget and it is blocked.
Thank you in advance for your help
Rémi
My code
…
source= ColumnDataSource( DataforPlot(Prod_name[0]) )
#source.column_names =>
#[‘RUBAX TABL MONO 100 MG 80’, ‘RUBAX TABL MONO 100 MG 20’,
#‘RUBAX TROPF 1 30 ML’, ‘RUBAX TROPF 1 10 ML’, ‘ProductSales’,
#RUBAX TABL MONO 100 MG 40’, ‘dates’]
···
#==============================================================================
Plot
#==============================================================================
Create figure
Toolbox= “pan,box_zoom,reset,save”
p = figure(x_axis_type=‘datetime’,plot_width=700, plot_height=500,
tools=Toolbox, title=“my sine wave”,)
p.xaxis.formatter=DatetimeTickFormatter(formats=dict(
months=[" %B %Y"],
years= [" %B %Y"], ))
p.xaxis.major_label_orientation = pi/4
p.xgrid[0].ticker.desired_num_ticks = 10
p.xaxis.axis_label = ‘Date’
text = TextInput(title=“title”, value=’ desactivate ! ')
draw line
y=‘ProductSales’
p.line( x=‘dates’ ,y=y , source=source)
update line fucntion
def update_plot(attr,old,new):
p.title.text = select.value
# get the new y data to draw the line
y= source.data.get(select.value)
x= source.data.get('dates')
#update source
source.data= dict(x=x, y=y)
#new line to draw !
p.line( x='dates' ,y=y , source=source)
create Widget
select = Select(title=“OTC Product:”, value=’ Product’, options= source.column_names)
select.on_change(“value”, update_plot)
…
``