Hello again,
Here is a minimal example, and I expect the result to be orange
colored legend with an alpha value of 1.0
. But it is not 
from bokeh.plotting import figure, show
from bokeh.io import output_notebook
from bokeh.models import ColumnDataSource, HoverTool, DatetimeTickFormatter, Legend, LegendItem
import pandas as pd
output_notebook()
start_time = [
'2022-02-06 15:04:54+00:00',
'2022-02-06 18:27:34+00:00',
'2022-02-06 18:30:34+00:00',
'2022-02-07 15:00:24+00:00',
'2022-02-08 01:34:14+00:00',
'2022-02-08 02:42:14+00:00']
end_time = [
'2022-02-07 15:04:54+00:00',
'2022-02-07 18:27:34+00:00',
'2022-02-07 18:30:34+00:00',
'2022-02-08 15:00:24+00:00',
'2022-02-09 01:34:14+00:00',
'2022-02-09 02:42:14+00:00']
price = [10, 20, 30, 40, 50, 60]
weight = [0.1, 0.9, 0.7, 0.4, 0.3, 1.0]
mycolor = ["orange", "orange", "orange", "orange", "orange", "orange"]
myalpha = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
prep_data = {
"start_time": start_time,
"end_time": end_time,
"price": price,
"weight": weight,
"mycolor": mycolor,
"myalpha": myalpha
}
df = pd.DataFrame(prep_data)
df['start_time'] = pd.to_datetime(df['start_time'])
df['end_time'] = pd.to_datetime(df['end_time'])
source = ColumnDataSource(df)
print(f'DEBUG: {source.data["mycolor"][5]}')
print(df)
my_tooltips = [
('start_time', '@start_time{%F %T}'),
('end_time', '@end_time{%F %T}')
]
hover_tool = HoverTool(
tooltips=my_tooltips,
formatters={
'@start_time': 'datetime',
'@end_time': 'datetime'
}
)
tools = [hover_tool]
p = figure(
x_axis_type = 'datetime',
tools=tools
)
start_circle = p.circle(x='start_time', y='price',
fill_color='red', fill_alpha=0.6, size=10,
line_color=None, source=source)
end_circle = p.circle(x='end_time', y='price',
fill_color='blue', fill_alpha=0.6, size=10,
line_color=None, source=source)
line = p.segment(
x0='start_time',
y0='price',
x1='end_time',
y1='price',
line_width=1,
line_cap='round',
line_dash='solid',
source=source
)
legend = Legend(items=[LegendItem(label="Orders", renderers=[start_circle, line, end_circle], index=4)],
location="center",
orientation="horizontal",
glyph_height=20,
glyph_width=20,
label_standoff=2,
label_text_font_size='8px',
click_policy='hide',
border_line_width=2,
margin=2,
padding=2,
spacing=10,
background_fill_color="#fcf5e3"
)
p.add_layout(legend, "above")
show(p)