callback = CustomJS(args=dict(source=source), code="""
var f = cb_obj.value
x = source.data[‘x’]
y = source.data[‘y’]
for (i = 0; i < x.length; i++) {
z[i] = Math.sin(x[i]/50 + f/10) * Math.cos(y[i]/50 + f/10)* 50 + 50
}
console.log(f)
color = z
source.change.emit();
“”")
Hi,
I am trying to link the source of graph3d vis example using a js callback attached to a slider.
I cannot get it working. The example in the documentation uses 'add_periodic_callback()' which works OK. Am I missing something?
Thanks
Aso
x = np.arange(0, 300, 10)
y = np.arange(0, 300, 10)
xx, yy = np.meshgrid(x, y)
xx = xx.ravel()
yy = yy.ravel()
t = 0
value = np.sin(xx/50 + t/10) * np.cos(yy/50 + t/10) * 50 + 50
callback = CustomJS(args=dict(source=source), code="""
var f = cb_obj.value
x = source.data['x']
y = source.data['y']
for (i = 0; i < x.length; i++) {
z[i] = Math.sin(x[i]/50 + f/10) * Math.cos(y[i]/50 + f/10)* 50 + 50
}
console.log(f)
color = z
source.change.emit();
""")