2cdf87a4e997d7792e5ac8494be939a7a4c88cd5,examples/plotting/file/slider.py,,,#,7
Before Change
plot.line("x", "y", source=source, line_width=3, line_alpha=0.6)
callback = CustomJS(args=dict(source=source), code=
var data = source.data;
var A = amp.value;
var k = freq.value;
var phi = phase.value;
var B = offset.value;
var x = data["x"]
var y = data["y"]
for (var i = 0; i < x.length; i++) {
y[i] = B + A*Math.sin(k*x[i]+phi);
}
source.change.emit();
)
amp_slider = Slider(start=0.1, end=10, value=1, step=.1,
title="Amplitude", callback=callback)
callback.args["amp"] = amp_slider
freq_slider = Slider(start=0.1, end=10, value=1, step=.1,
title="Frequency", callback=callback)
callback.args["freq"] = freq_slider
phase_slider = Slider(start=0, end=6.4, value=0, step=.1,
title="Phase", callback=callback)
callback.args["phase"] = phase_slider
offset_slider = Slider(start=-5, end=5, value=0, step=.1,
title="Offset", callback=callback)
callback.args["offset"] = offset_slider
layout = row(
plot,
column(amp_slider, freq_slider, phase_slider, offset_slider),
After Change
phase_slider = Slider(start=0, end=6.4, value=0, step=.1, title="Phase")
offset_slider = Slider(start=-5, end=5, value=0, step=.1, title="Offset")
callback = CustomJS(args=dict(source=source, amp=amp_slider, freq=freq_slider, phase=phase_slider, offset=offset_slider),
code=
const data = source.data;
const A = amp.value;
const k = freq.value;
const phi = phase.value;
const B = offset.value;
const x = data["x"]
const y = data["y"]
for (var i = 0; i < x.length; i++) {
y[i] = B + A*Math.sin(k*x[i]+phi);
}
source.change.emit();
)
amp_slider.js_on_change("value", callback)
freq_slider.js_on_change("value", callback)
phase_slider.js_on_change("value", callback)
offset_slider.js_on_change("value", callback)
layout = row(
plot,
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 13
Instances
Project Name: bokeh/bokeh
Commit Name: 2cdf87a4e997d7792e5ac8494be939a7a4c88cd5
Time: 2019-05-15
Author: bryan@bokeh.org
File Name: examples/plotting/file/slider.py
Class Name:
Method Name:
Project Name: bokeh/bokeh
Commit Name: 2cdf87a4e997d7792e5ac8494be939a7a4c88cd5
Time: 2019-05-15
Author: bryan@bokeh.org
File Name: examples/howto/layouts/dashboard.py
Class Name:
Method Name: slider
Project Name: bokeh/bokeh
Commit Name: 2cdf87a4e997d7792e5ac8494be939a7a4c88cd5
Time: 2019-05-15
Author: bryan@bokeh.org
File Name: examples/plotting/file/color_sliders.py
Class Name:
Method Name: