- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我是 Bokeh 新手,正在尝试使用 CustomJS 实现 Slider 回调。我的销售数据按年、月、日分组。根据 slider 值(1-12),我的每月数据必须在绘图上更改。下面是我的代码: slider 值(0-12)- 月份数字X 轴:天(1-30)y 轴:销售额
df3=df
df3['Date2'] = pd.to_datetime(df['Inv Date'])
df3.set_index('Date2', inplace=True)
df3['month'] = df3.index.month
df3['year'] = df3.index.year
df3['day'] = df3.index.day
df3['Dateday'] = pd.to_datetime(df3[['year','month', 'day']])
source1=df3.groupby(['year','month','day'], as_index = False).sum()
current_month=ColumnDataSource(source1[source1['year']== dt.now().year])
hover3 = HoverTool(
tooltips = [
('day', '@day'),
('Sales','@{Sales}{0,0}'),
],
formatters = {
'day': 'datetime',
'Sales': 'numeral'}
)
p = figure(
title='YEARLY SALES',
plot_width=600,
plot_height=400,
min_border=3,
tools = [hover3,'box_zoom','wheel_zoom', 'pan','reset'],
toolbar_location="above")
p.vbar(x='day', top='Sales', width=0.2, color='#e8bc76',
source=current_month)
p.xaxis.axis_label = 'Day'
p.xaxis.axis_label_text_font_style = 'normal'
p.xaxis.axis_label_text_font_size = '12pt'
p.yaxis[0].formatter = NumeralTickFormatter(format="0,0")
callback = CustomJS(args=dict(source=current_month), code="""
var f = slider.get('value');
var data = source.data;
data1=current_month[current_month['month']== f]
day=data1[data1['day']]
Sales=data1[data1['Sales']]
source.trigger('change');
""")
slider = Slider(start=1, end=12, value=1, step=1, title="power",
callback=callback)
layout = column(slider, p)
show(layout)
谁能帮帮我。我被困在这里根据自定义回调过滤我的数据帧。
最佳答案
如果您想使用可以调用 native Python 回调函数的 bokehserve
,这将相当快。这也可以使用 javascript 回调 CustomJS
实现。
由于我没有您的数据,因此我使用以下代码生成了虚拟数据 -
import pandas as pd
import random
from datetime import timedelta
df = pd.DataFrame({'base' : ["2017-01-01" for t in range(10000)],
'Date' : [random.randint(0, 1035) for t in range(10000)],
'Sales' : [random.random() for t in range(10000)]})
df['base'] = pd.to_datetime(df['base'])
df["Date2"] = df.apply(lambda x: x["base"] + timedelta(days=x['Date']), axis=1)
df.drop(['base', 'Date'], axis=1, inplace=True)
这将提供 2017 年至 2019 年之间的 10000 行随机销售。在下面的示例中,我仅过滤了 2017 年。
在下一步中,我将生成两个 ColumnDataSource
- 一个用于 2017 年所有数据,另一个仅用于 2017 年第 1 个月的数据 - 以创建初始图表。第二个将用于生成 vbar
from bokeh.models.widgets import Slider
from bokeh.layouts import widgetbox, column
from bokeh.models import Slider, ColumnDataSource, CustomJS
from bokeh.plotting import figure, curdoc
from bokeh.core.properties import value
from bokeh.models.ranges import FactorRange
from bokeh.plotting import figure, output_file, show, ColumnDataSource
from bokeh.models import ColumnDataSource, CDSView, IndexFilter, BooleanFilter, HoverTool
df.set_index('Date2', inplace=True)
df['month'] = df.index.month
df['year'] = df.index.year
df['day'] = df.index.day
source1=df.groupby(['year','month','day'], as_index = False).sum()
source = source1[source1['year']== 2017]
sourcex = source[source['month'] ==1]
Overall=ColumnDataSource(source)
Curr=ColumnDataSource(sourcex)
boolinit = source['month']==1
view = CDSView(source=Overall, filters=[BooleanFilter(boolinit)])
hover3 = HoverTool(tooltips = [('day', '@day'),('Sales','@{Sales}{0,0}')],
formatters = {'day': 'datetime','Sales': 'numeral'})
p = figure(title='YEARLY SALES', plot_width=600, plot_height=400, min_border=3,
tools = [hover3,'box_zoom','wheel_zoom', 'pan','reset'],
toolbar_location="above")
r = p.vbar(x='day', top='Sales', width=0.2, color='#e8bc76', source=Curr)
p.xaxis.axis_label = 'Day'
p.xaxis.axis_label_text_font_style = 'normal'
p.xaxis.axis_label_text_font_size = '12pt'
现在,我们将编写 JavaScript 回调函数,它将通过在整个 ColumnDataSource
上应用过滤器来更改 vbar
中使用的 ColumnDataSource
。将其添加到 slider 回调中,我们就有了一个基于 javascript 的数据过滤器 -
callback = CustomJS(args=dict(source=Overall, sc=Curr), code="""
var f = slider.value;
sc.data['x'] = [];
sc.data['top'] = [];
for (var i = 0; i <= source.get_length(); i++){
if (source.data['month'][i] == f){
sc.data['day'].push(source.data['day'][i])
sc.data['Sales'].push(source.data['Sales'][i])
}
}
sc.change.emit();
""")
slider = Slider(start=1, end=12, value=1, step=1, title="Month", callback=callback)
callback.args["slider"] = slider
layout = column(slider, p)
output_file("Filterdata.html")
#fig.view.filters[0].booleans = indices
show(layout)
这将生成以下类型的 HTML -
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Bokeh Plot</title>
<link rel="stylesheet" href="https://cdn.bokeh.org/bokeh/release/bokeh-0.12.16.min.css" type="text/css" />
<link rel="stylesheet" href="https://cdn.bokeh.org/bokeh/release/bokeh-widgets-0.12.16.min.css" type="text/css" />
<script type="text/javascript" src="https://cdn.bokeh.org/bokeh/release/bokeh-0.12.16.min.js"></script>
<script type="text/javascript" src="https://cdn.bokeh.org/bokeh/release/bokeh-widgets-0.12.16.min.js"></script>
<script type="text/javascript">
Bokeh.set_log_level("info");
</script>
</head>
<body>
<div class="bk-root">
<div class="bk-plotdiv" id="1b4d2791-052d-4f87-b697-2703d126d006"></div>
</div>
<script type="application/json" id="59b3ceeb-f6e4-457f-8243-236ad4e4ecc6">
{"6e250d5c-2f75-4d15-9ea7-19bd720babe3":{"roots":{"references":[{"attributes":{"callback":null,"formatters":{"Sales":"numeral","day":"datetime"},"renderers":"auto","tooltips":[["day","@day"],["Sales","@{Sales}{0,0}"]]},"id":"07bbdbc1-b49b-4f0e-a9b7-214f33f39250","type":"HoverTool"},{"attributes":{"bottom_units":"screen","fill_alpha":{"value":0.5},"fill_color":{"value":"lightgrey"},"left_units":"screen","level":"overlay","line_alpha":{"value":1.0},"line_color":{"value":"black"},"line_dash":[4,4],"line_width":{"value":2},"plot":null,"render_mode":"css","right_units":"screen","top_units":"screen"},"id":"554a6885-1e34-4138-80c0-2dbb98325bc3","type":"BoxAnnotation"},{"attributes":{"children":[{"id":"e8e7c404-9a9e-4a03-bdd4-3f0bcd5dc234","type":"WidgetBox"},{"id":"afe8da60-9dbb-4cea-958f-247636333a7c","subtype":"Figure","type":"Plot"}]},"id":"0a97fc7d-20ab-49fa-b18f-ca63fdc4d277","type":"Column"},{"attributes":{"axis_label":"Day","axis_label_text_font_size":{"value":"12pt"},"axis_label_text_font_style":"normal","formatter":{"id":"1909b1bd-0493-46ce-a5f6-b7dbdc4853c3","type":"BasicTickFormatter"},"plot":{"id":"afe8da60-9dbb-4cea-958f-247636333a7c","subtype":"Figure","type":"Plot"},"ticker":{"id":"238e4175-dd46-4884-b52d-12443011009a","type":"BasicTicker"}},"id":"7e35e0a2-4439-4e0e-a3c1-47fbd9e6fa37","type":"LinearAxis"},{"attributes":{"formatter":{"id":"19bf27b3-a519-4d20-ae4b-1228506e8c65","type":"BasicTickFormatter"},"plot":{"id":"afe8da60-9dbb-4cea-958f-247636333a7c","subtype":"Figure","type":"Plot"},"ticker":{"id":"2ee2fcc2-f073-43b3-9aca-2ee8c03357fa","type":"BasicTicker"}},"id":"e9dd9ab8-79fd-43f3-96a0-3a8b0e833438","type":"LinearAxis"},{"attributes":{"data_source":{"id":"fe1ac751-02a0-4545-89ff-87dbe314a34f","type":"ColumnDataSource"},"glyph":{"id":"aa4dd815-46f2-42c9-9b8a-1779434e9afc","type":"VBar"},"hover_glyph":null,"muted_glyph":null,"nonselection_glyph":{"id":"25d28579-4ce2-4d3e-8946-c6e0500c573c","type":"VBar"},"selection_glyph":null,"view":{"id":"c32a4aeb-a7a3-4130-a0e0-af65a56efacf","type":"CDSView"}},"id":"552417f6-d44d-4004-8d17-81b1e4b05e7b","type":"GlyphRenderer"},{"attributes":{"children":[{"id":"eb513edf-4b54-4590-9b7b-d4cc1f60420c","type":"Slider"}]},"id":"e8e7c404-9a9e-4a03-bdd4-3f0bcd5dc234","type":"WidgetBox"},{"attributes":{},"id":"bcfbd38a-8abf-4a13-a5e2-61ebfe5004a1","type":"PanTool"},{"attributes":{"callback":null},"id":"b3d136e0-d5f7-4255-9038-d25e07847ec2","type":"DataRange1d"},{"attributes":{},"id":"1909b1bd-0493-46ce-a5f6-b7dbdc4853c3","type":"BasicTickFormatter"},{"attributes":{"below":[{"id":"7e35e0a2-4439-4e0e-a3c1-47fbd9e6fa37","type":"LinearAxis"}],"left":[{"id":"e9dd9ab8-79fd-43f3-96a0-3a8b0e833438","type":"LinearAxis"}],"min_border":3,"plot_height":400,"renderers":[{"id":"7e35e0a2-4439-4e0e-a3c1-47fbd9e6fa37","type":"LinearAxis"},{"id":"bafbac35-977e-4aff-9a7f-794ec9b01659","type":"Grid"},{"id":"e9dd9ab8-79fd-43f3-96a0-3a8b0e833438","type":"LinearAxis"},{"id":"c72d4b3e-b711-4ba8-a197-82ad4457ed7e","type":"Grid"},{"id":"554a6885-1e34-4138-80c0-2dbb98325bc3","type":"BoxAnnotation"},{"id":"552417f6-d44d-4004-8d17-81b1e4b05e7b","type":"GlyphRenderer"}],"title":{"id":"f6ba763a-1582-4691-8c88-658157e6752c","type":"Title"},"toolbar":{"id":"95b4b9e2-94be-4be2-9761-be749c59ae45","type":"Toolbar"},"toolbar_location":"above","x_range":{"id":"c3a3bd50-523c-4fb1-b623-179318de5821","type":"DataRange1d"},"x_scale":{"id":"366a8395-e407-44d6-9740-75995f462aa6","type":"LinearScale"},"y_range":{"id":"b3d136e0-d5f7-4255-9038-d25e07847ec2","type":"DataRange1d"},"y_scale":{"id":"61100931-0c81-49dd-b38e-b0ba2ad2b715","type":"LinearScale"}},"id":"afe8da60-9dbb-4cea-958f-247636333a7c","subtype":"Figure","type":"Plot"},{"attributes":{"callback":null},"id":"c3a3bd50-523c-4fb1-b623-179318de5821","type":"DataRange1d"},{"attributes":{},"id":"19bf27b3-a519-4d20-ae4b-1228506e8c65","type":"BasicTickFormatter"},{"attributes":{},"id":"f6af654a-341d-45a8-a1a4-c2d17e5ea072","type":"UnionRenderers"},{"attributes":{"overlay":{"id":"554a6885-1e34-4138-80c0-2dbb98325bc3","type":"BoxAnnotation"}},"id":"8bd715e6-c00a-4a79-b615-697fac1cb0ff","type":"BoxZoomTool"},{"attributes":{},"id":"238e4175-dd46-4884-b52d-12443011009a","type":"BasicTicker"},{"attributes":{"dimension":1,"plot":{"id":"afe8da60-9dbb-4cea-958f-247636333a7c","subtype":"Figure","type":"Plot"},"ticker":{"id":"2ee2fcc2-f073-43b3-9aca-2ee8c03357fa","type":"BasicTicker"}},"id":"c72d4b3e-b711-4ba8-a197-82ad4457ed7e","type":"Grid"},{"attributes":{"callback":null,"data":{"Sales":{"__ndarray__":"8NQrVcgzF0BmMWa9ZFEJQI0Nm+l22BFAkpu8wBOxG0CFf2FD7okNQKqmXZOEDhlAwIGsfto5FkBnl1JfhlwQQFbqcDGFTRJAr0Xiczd5IkDSpmZHOyURQNRIWMMZqwVA4DSUAzIkHkDly04nIZsJQAxQHPiCBwpA9bjTr6g0GUBlCMyBLaMdQI0PreXoOQVADFRAxvEIFkAcwvjsW4UPQFBni1oUUxhAJzhcwTr6GkD73ROYc0ERQIIKgPW5OglAjuGAQmxwFkBMPcUNQeEVQGD60x1g+RZAAuog6+lOFEAtXcdh1csRQGrJzOkK3A5ATOF2Rs3rGUA=","dtype":"float64","shape":[31]},"day":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31],"index":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30],"month":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],"year":[2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017]},"selected":{"id":"b457b820-5485-4b7a-9872-3c44fad0cd7a","type":"Selection"},"selection_policy":{"id":"3b7b5e0f-6ed6-43f4-af7c-f949bf6641b9","type":"UnionRenderers"}},"id":"fe1ac751-02a0-4545-89ff-87dbe314a34f","type":"ColumnDataSource"},{"attributes":{},"id":"3b7b5e0f-6ed6-43f4-af7c-f949bf6641b9","type":"UnionRenderers"},{"attributes":{},"id":"366a8395-e407-44d6-9740-75995f462aa6","type":"LinearScale"},{"attributes":{},"id":"b457b820-5485-4b7a-9872-3c44fad0cd7a","type":"Selection"},{"attributes":{"args":{"sc":{"id":"fe1ac751-02a0-4545-89ff-87dbe314a34f","type":"ColumnDataSource"},"slider":{"id":"eb513edf-4b54-4590-9b7b-d4cc1f60420c","type":"Slider"},"source":{"id":"b605ddc1-1408-4956-864f-c602df6f550a","type":"ColumnDataSource"}},"code":" \n var f = slider.value;\n sc.data['x'] = [];\n sc.data['top'] = [];\n for (var i = 0; i <= source.get_length(); i++){\n if (source.data['month'][i] == f){\n sc.data['x'].push(source.data['day'][i])\n sc.data['top'].push(source.data['Sales'][i])\n }\n }\n sc.change.emit();\n "},"id":"46a732ae-b9c4-4617-b4fe-831f344608ec","type":"CustomJS"},{"attributes":{},"id":"0f4916a7-aa28-4cdb-839e-f4de9080462d","type":"WheelZoomTool"},{"attributes":{"active_drag":"auto","active_inspect":"auto","active_scroll":"auto","active_tap":"auto","tools":[{"id":"07bbdbc1-b49b-4f0e-a9b7-214f33f39250","type":"HoverTool"},{"id":"8bd715e6-c00a-4a79-b615-697fac1cb0ff","type":"BoxZoomTool"},{"id":"0f4916a7-aa28-4cdb-839e-f4de9080462d","type":"WheelZoomTool"},{"id":"bcfbd38a-8abf-4a13-a5e2-61ebfe5004a1","type":"PanTool"},{"id":"14f7d7d3-d67b-4d72-a86d-6a1d7b5dcc7d","type":"ResetTool"}]},"id":"95b4b9e2-94be-4be2-9761-be749c59ae45","type":"Toolbar"},{"attributes":{},"id":"14f7d7d3-d67b-4d72-a86d-6a1d7b5dcc7d","type":"ResetTool"},{"attributes":{},"id":"2ee2fcc2-f073-43b3-9aca-2ee8c03357fa","type":"BasicTicker"},{"attributes":{"fill_color":{"value":"#e8bc76"},"line_color":{"value":"#e8bc76"},"top":{"field":"Sales"},"width":{"value":0.2},"x":{"field":"day"}},"id":"aa4dd815-46f2-42c9-9b8a-1779434e9afc","type":"VBar"},{"attributes":{"source":{"id":"fe1ac751-02a0-4545-89ff-87dbe314a34f","type":"ColumnDataSource"}},"id":"c32a4aeb-a7a3-4130-a0e0-af65a56efacf","type":"CDSView"},{"attributes":{"plot":{"id":"afe8da60-9dbb-4cea-958f-247636333a7c","subtype":"Figure","type":"Plot"},"ticker":{"id":"238e4175-dd46-4884-b52d-12443011009a","type":"BasicTicker"}},"id":"bafbac35-977e-4aff-9a7f-794ec9b01659","type":"Grid"},{"attributes":{"callback":null,"data":{"Sales":{"__ndarray__":"8NQrVcgzF0BmMWa9ZFEJQI0Nm+l22BFAkpu8wBOxG0CFf2FD7okNQKqmXZOEDhlAwIGsfto5FkBnl1JfhlwQQFbqcDGFTRJAr0Xiczd5IkDSpmZHOyURQNRIWMMZqwVA4DSUAzIkHkDly04nIZsJQAxQHPiCBwpA9bjTr6g0GUBlCMyBLaMdQI0PreXoOQVADFRAxvEIFkAcwvjsW4UPQFBni1oUUxhAJzhcwTr6GkD73ROYc0ERQIIKgPW5OglAjuGAQmxwFkBMPcUNQeEVQGD60x1g+RZAAuog6+lOFEAtXcdh1csRQGrJzOkK3A5ATOF2Rs3rGUDcCe5/LloZQIKhPIgsmxFAQeGIsVoIH0CgX8ftSWwQQLQUWKTk2gVANBBCmqgQG0AoFo/wcJsCQMcd+dVqygBAXoPqzz2+DEAiSoodlwbnPzd6L9mRnBVAXRRuHBgpFkD6+NkXjZwTQF8ePXB/nxFANBWQzSsWFUBHXcLlvs4TQPSn15SkyBJARPeQT55YEkBQ+Yv2i9UlQMxjbOs6xBZApTqcn4+GDUAvBG4aIacSQE/D56UMgAlAx4rt+BdfEECm3XIyRm8SQPEfMTf8JxZASLyXohPcGECrH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uEPfIHEBQvdtGUBsUQK52NcB2sv4/SKzKyCVRFUBd1ryQ8fkUQA==","dtype":"float64","shape":[365]},"day":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31],"index":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364],"month":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12],"year":[2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017,2017]},"selected":{"id":"f24d2be8-f2e0-4cf3-9823-80c20d1a436e","type":"Selection"},"selection_policy":{"id":"f6af654a-341d-45a8-a1a4-c2d17e5ea072","type":"UnionRenderers"}},"id":"b605ddc1-1408-4956-864f-c602df6f550a","type":"ColumnDataSource"},{"attributes":{"fill_alpha":{"value":0.1},"fill_color":{"value":"#1f77b4"},"line_alpha":{"value":0.1},"line_color":{"value":"#1f77b4"},"top":{"field":"Sales"},"width":{"value":0.2},"x":{"field":"day"}},"id":"25d28579-4ce2-4d3e-8946-c6e0500c573c","type":"VBar"},{"attributes":{},"id":"61100931-0c81-49dd-b38e-b0ba2ad2b715","type":"LinearScale"},{"attributes":{"plot":null,"text":"YEARLY SALES"},"id":"f6ba763a-1582-4691-8c88-658157e6752c","type":"Title"},{"attributes":{"callback":{"id":"46a732ae-b9c4-4617-b4fe-831f344608ec","type":"CustomJS"},"end":12,"start":1,"title":"Month","value":1},"id":"eb513edf-4b54-4590-9b7b-d4cc1f60420c","type":"Slider"},{"attributes":{},"id":"f24d2be8-f2e0-4cf3-9823-80c20d1a436e","type":"Selection"}],"root_ids":["0a97fc7d-20ab-49fa-b18f-ca63fdc4d277"]},"title":"Bokeh Application","version":"0.12.16"}}
</script>
<script type="text/javascript">
(function() {
var fn = function() {
Bokeh.safely(function() {
(function(root) {
function embed_document(root) {
var docs_json = document.getElementById('59b3ceeb-f6e4-457f-8243-236ad4e4ecc6').textContent;
var render_items = [{"docid":"6e250d5c-2f75-4d15-9ea7-19bd720babe3","elementid":"1b4d2791-052d-4f87-b697-2703d126d006","modelid":"0a97fc7d-20ab-49fa-b18f-ca63fdc4d277"}];
root.Bokeh.embed.embed_items(docs_json, render_items);
}
if (root.Bokeh !== undefined) {
embed_document(root);
} else {
var attempts = 0;
var timer = setInterval(function(root) {
if (root.Bokeh !== undefined) {
embed_document(root);
clearInterval(timer);
}
attempts++;
if (attempts > 100) {
console.log("Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing")
clearInterval(timer);
}
}, 10, root)
}
})(window);
});
};
if (document.readyState != "loading") fn();
else document.addEventListener("DOMContentLoaded", fn);
})();
</script>
</body>
</html>
关于python - Bokeh Slider自定义JS回调,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50689700/
好的,所以我编辑了以下... 只需将以下内容放入我的 custom.css #rt-utility .rt-block {CODE HERE} 但是当我尝试改变... 与 #rt-sideslid
在表格 View 中,我有一个自定义单元格(在界面生成器中高度为 500)。在该单元格中,我有一个 Collection View ,我按 (10,10,10,10) 固定到边缘。但是在 tablev
对于我的无能,我很抱歉,但总的来说,我对 Cocoa、Swift 和面向对象编程还很陌生。我的主要来源是《Cocoa Programming for OS X》(第 5 版),以及 Apple 的充满
我正在使用 meta-tegra 为我的 NVIDIA Jetson Nano 构建自定义图像。我需要 PyTorch,但没有它的配方。我在设备上构建了 PyTorch,并将其打包到设备上的轮子中。现
在 jquery 中使用 $.POST 和 $.GET 时,有没有办法将自定义变量添加到 URL 并发送它们?我尝试了以下方法: $.ajax({type:"POST", url:"file.php?
Traefik 已经默认实现了很多中间件,可以满足大部分我们日常的需求,但是在实际工作中,用户仍然还是有自定义中间件的需求,为解决这个问题,官方推出了一个 Traefik Pilot[1] 的功
我想让我的 CustomTextInputLayout 将 Widget.MaterialComponents.TextInputLayout.OutlinedBox 作为默认样式,无需在 XML 中
我在 ~/.emacs 中有以下自定义函数: (defun xi-rgrep (term) (grep-compute-defaults) (interactive "sSearch Te
我有下表: 考虑到每个月的权重,我的目标是在 5 个月内分散 10,000 个单位。与 10,000 相邻的行是我最好的尝试(我在这上面花了几个小时)。黄色是我所追求的。 我试图用来计算的逻辑如下:计
我的表单中有一个字段,它是文件类型。当用户点击保存图标时,我想自然地将文件上传到服务器并将文件名保存在数据库中。我尝试通过回显文件名来测试它,但它似乎不起作用。另外,如何将文件名添加到数据库中?是在模
我有一个 python 脚本来发送电子邮件,它工作得很好,但问题是当我检查我的电子邮件收件箱时。 我希望该用户名是自定义用户名,而不是整个电子邮件地址。 最佳答案 发件人地址应该使用的格式是: You
我想减小 ggcorrplot 中标记的大小,并减少文本和绘图之间的空间。 library(ggcorrplot) data(mtcars) corr <- round(cor(mtcars), 1)
GTK+ noob 问题在这里: 是否可以自定义 GtkFileChooserButton 或 GtkFileChooserDialog 以删除“位置”部分(左侧)和顶部的“位置”输入框? 我实际上要
我正在尝试在主页上使用 ajax 在 magento 中使用 ajax 显示流行的产品列表,我可以为 5 或“N”个产品执行此操作,但我想要的是将分页工具栏与结果集一起添加. 这是我添加的以显示流行产
我正在尝试使用 PasswordResetForm 内置函数。 由于我想要自定义表单字段,因此我编写了自己的表单: class FpasswordForm(PasswordResetForm):
据我了解,新的 Angular 7 提供了拖放功能。我搜索了有关 DnD 的 Tree 组件,但没有找到与树相关的内容。 我在 Stackblitz 上找到的一个工作示例.对比drag'ndrop功能
我必须开发一个自定义选项卡控件并决定使用 WPF/XAML 创建它,因为我无论如何都打算学习它。完成后应该是这样的: 到目前为止,我取得了很好的进展,但还有两个问题: 只有第一个/最后一个标签项应该有
我要定制xtable用于导出到 LaTeX。我知道有些问题是关于 xtable在这里,但我找不到我要找的具体东西。 以下是我的表的外观示例: my.table <- data.frame(Specif
用ejs在这里显示日期 它给我结果 Tue Feb 02 2016 16:02:24 GMT+0530 (IST) 但是我需要表现为 19th January, 2016 如何在ejs中执行此操作?
我想问在 JavaFX 中使用自定义对象制作 ListView 的最佳方法,我想要一个每个项目如下所示的列表: 我搜了一下,发现大部分人都是用细胞工厂的方法来做的。有没有其他办法?例如使用客户 fxm
我是一名优秀的程序员,十分优秀!