Hi,
I try to make an interactive plot similar to this example:
However for each point selected on the left panel, I want to plot a time series on the right.
E.g. input x and y shape is (10, ), then the shape of the arrays of hjd and flux is
(10, 168), and thus represent a full time series for each point.
I didn’t find and example more similar to what I want, and somehow I assumed that the following code should work, but it doesn’t. I have to admit that my JS
skills are extremely limited, so I hope someone could point out a trivial error in the snippet below.
Many thanks.
Brigitta
source = ColumnDataSource(data=dict(y1=y1[:10], x0=x0[:10], x1=x1[:10], hjd=hjd, flux=flux))
s2 = ColumnDataSource(data=dict(hjd=[], flux=[], y1=[], x1=[]))
pp.circle('hjd', 'flux', source=s2)
source.callback = CustomJS(args=dict(s2=s2), code="""
var inds = cb_obj.get('selected')['1d'].indices;
var d1 = cb_obj.get('data');
var d2 = s2.get('data');
d2['x1'] = []
d2['hjd'] = []
d2['flux'] = []
for (i = 0; i < inds.length; i++) {
for (j = 0; j < d1['hjd'][inds[i]].lenght; j++) {
d2['hjd'].push(d1['hjd'][inds[i]][j])
d2['flux'].push(d1['flux'][inds[i]][j])
}
}
s2.trigger('change');
""")

