I have data in format of given image. data format I'm finding it difficult to add "Checkbox" of variables and "Slider" for index date range. I have researched through StackOverflow a lot but since I haveno knowledge on Jqurey or js i couldn't figure out what to do. attaching my code :
`
from bokeh.palettes import Spectral11
from bokeh.plotting import figure, show, output_file
from bokeh.models import Legend, LegendItem
from bokeh.models import ColumnDataSource, HoverTool
from bokeh.models import CustomJS, Slider
from bokeh.layouts import row, widgetbox
from bokeh.models import CustomJS, Slider
from bokeh.plotting import figure, output_file, show, ColumnDataSource
output_file('temp.html')
numlines=len(data.columns)
mypalette=Spectral11[0:numlines]
p = figure(width=1100, height=650, x_axis_type="datetime")
r =p.multi_line(xs=[data.index.values]*numlines,
ys=[data[name].values for name in data],
line_color=mypalette,
line_width=3)
legend = Legend(items=[
LegendItem(label=f"{X_t_list[:1]}", renderers=[r], index=0),
LegendItem(label=f"{X_t_list[1:2]}", renderers=[r], index=1),
LegendItem(label=f"{X_t_list[2:3]}", renderers=[r], index=2),
LegendItem(label=f"{X_t_list[3:4]}", renderers=[r], index=3),
LegendItem(label=f"{X_t_list[4:5]}", renderers=[r], index=4),
LegendItem(label=f"{X_t_list[5:6]}", renderers=[r], index=5),
LegendItem(label=f"{X_t_list[6:7]}", renderers=[r], index=6),
LegendItem(label=f"{X_t_list[7:8]}", renderers=[r], index=7),
LegendItem(label=f"{X_t_list[8:9]}", renderers=[r], index=8),
LegendItem(label=f"{X_t_list[9:10]}", renderers=[r], index=9),
LegendItem(label=f"{X_t_list[10:11]}", renderers=[r], index=10),])
p.add_layout(legend)
show(p)
`
Can someone help me with this ??
Aucun commentaire:
Enregistrer un commentaire