예제 #1
0
int_hhover = int_hline.select(dict(type=HoverTool))
int_hhover.mode = 'hline'
int_hhover.line_policy = 'interp'

int_vhover = int_vline.select(dict(type=HoverTool))
int_vhover.mode = 'vline'
int_vhover.line_policy = 'interp'

iphover = int_point_line.select(dict(type=HoverTool))
iphover.mode = 'mouse'
iphover.line_policy = 'interp'

tphover = point_line.select(dict(type=HoverTool))
tphover.mode = 'mouse'

shover = scatter.select(dict(type=HoverTool))
shover.mode = 'vline'

shoverp = scatter_point.select(dict(type=HoverTool))
shoverp.mode = 'mouse'

int_vhover.tooltips = int_hhover.tooltips = tphover.tooltips = iphover.tooltips = shover.tooltips = shoverp.tooltips = vhover.tooltips = hhover.tooltips = OrderedDict([
    ("y", "$~y"),
    ("x", "$~x"),
    # ("data_x", "$~x"),
    # ("data_y", "$~y"),
])

show(
    vplot(
        hplot(hline, vline),
예제 #2
0
파일: hover_span.py 프로젝트: chakas/bokeh
int_hhover = int_hline.select(HoverTool)
int_hhover.mode = 'hline'
int_hhover.line_policy = 'interp'

int_vhover = int_vline.select(HoverTool)
int_vhover.mode = 'vline'
int_vhover.line_policy = 'interp'

iphover = int_point_line.select(HoverTool)
iphover.mode = 'mouse'
iphover.line_policy = 'interp'

tphover = point_line.select(HoverTool)
tphover.mode = 'mouse'

shover = scatter.select(HoverTool)
shover.mode = 'vline'

shoverp = scatter_point.select(HoverTool)
shoverp.mode = 'mouse'

# set up tooltips
int_vhover.tooltips = int_hhover.tooltips = TOOLTIPS
tphover.tooltips = iphover.tooltips = TOOLTIPS
shover.tooltips = shoverp.tooltips = TOOLTIPS
vhover.tooltips = hhover.tooltips = TOOLTIPS

output_file("hover_span.html", title="line.py example")

show(vplot(
    hplot(hline, vline),
예제 #3
0
파일: hover_span.py 프로젝트: tengqu/bokeh
int_hhover = int_hline.select(dict(type=HoverTool))
int_hhover.mode = 'hline'
int_hhover.line_policy = 'interp'

int_vhover = int_vline.select(dict(type=HoverTool))
int_vhover.mode = 'vline'
int_vhover.line_policy = 'interp'

iphover = int_point_line.select(dict(type=HoverTool))
iphover.mode = 'mouse'
iphover.line_policy = 'interp'

tphover = point_line.select(dict(type=HoverTool))
tphover.mode = 'mouse'

shover = scatter.select(dict(type=HoverTool))
shover.mode = 'vline'

shoverp = scatter_point.select(dict(type=HoverTool))
shoverp.mode = 'mouse'

int_vhover.tooltips = int_hhover.tooltips = tphover.tooltips = iphover.tooltips = shover.tooltips = shoverp.tooltips = vhover.tooltips = hhover.tooltips = OrderedDict(
    [
        ("y", "$~y"),
        ("x", "$~x"),
        # ("data_x", "$~x"),
        # ("data_y", "$~y"),
    ])

show(
    vplot(
예제 #4
0
int_hhover = int_hline.select(HoverTool)
int_hhover.mode = 'hline'
int_hhover.line_policy = 'interp'

int_vhover = int_vline.select(HoverTool)
int_vhover.mode = 'vline'
int_vhover.line_policy = 'interp'

iphover = int_point_line.select(HoverTool)
iphover.mode = 'mouse'
iphover.line_policy = 'interp'

tphover = point_line.select(HoverTool)
tphover.mode = 'mouse'

shover = scatter.select(HoverTool)
shover.mode = 'vline'

shoverp = scatter_point.select(HoverTool)
shoverp.mode = 'mouse'

# set up tooltips
int_vhover.tooltips = int_hhover.tooltips = TOOLTIPS
tphover.tooltips = iphover.tooltips = TOOLTIPS
shover.tooltips = shoverp.tooltips = TOOLTIPS
vhover.tooltips = hhover.tooltips = TOOLTIPS

output_file("hover_span.html", title="hover_span.py example")

show(
    vplot(
cursor.execute(sql)
sql = """INSERT INTO prod1 SELECT prod_id, COUNT(cust_id)AS frequency FROM new_schema.cust2 GROUP BY prod_id ORDER BY prod_id;"""
cursor.execute(sql)
sql = """select * from prod1;"""
cursor.execute(sql)

data = cursor.fetchall()
print(data)
df = pd.DataFrame([[ij for ij in i] for i in data])
df.rename(columns={
    0: 'Product ID',
    1: 'Frequency'
}, inplace=True)
df = df.sort_values(['Product ID'], ascending=[1])
print(df.head(1536))

#from bokeh.sampledata.autompg import autompg as df
from bokeh.charts import Scatter, output_file, show, save
from bokeh.models import HoverTool

scatter = Scatter(df,
                  x='Product ID',
                  y='Frequency',
                  tools='hover',
                  legend=False)
hover = scatter.select(dict(type=HoverTool))
hover.tooltips = [("Product ID", "$x{int}"), ("Frequency", "$y{int}")]
print(df.head())
output_file('prodscatter.html')
save(scatter)