Assume the source has 4 columns named time_s, time_min, time_h
and y.
source = ColumnDataSource(...)
Then from those columns initially time_s and y are selected
p = figure(tools=tools, toolbar_location="above")
p.line(x='time_s', y='y', source=source)
In a CustomJS callback codeblock I would like to switch the x-column from time_s to maybe time_min and rerender the plot accordingly. I know how I can explore / access some of the data and objects in general by analysing them in the DevTools-console, but I cannot find the x='time_s' from the p.line object or how it can be accessed.
js = """
// Explore Objects in DevTools Console
console.log(data)
console.log(source)
console.log(plot)
data = source.data
data['time_s'] = do something to column here ...
if (widget.value === 'xyz') {
// Looking for something like:
plot.line.x = data['time_min'] // not working
}
// After data change -> rerender
source.change.emit()
"""
cb = CustomJS(args=dict(src=source, plot=p, widget=mywidget), code=js)
mywidget.js_on_change('value', cb)
So how can this be done?