0

I'm trying to use RangeSlider widget from Panel library in a Holoviews Table (Dynamicmap). However, after trying different ways of doing this, I am not being able to make this connection.

I was trying to do it in the following way:

import pandas as pd
import os
from bokeh.models.widgets import TableColumn, DataTable
import holoviews as hv
from holoviews import opts
import panel as pn
hv.extension('bokeh')

technical_data_table = pd.read_csv(os.path.join(Data_folder,'Technical_Data_Table.csv'))

RSI_slider = pn.widgets.RangeSlider(name='RSI Range', start=0, end=100, value=(0, 100), step=0.01)

RSI_value = (RSI_slider.value[0], RSI_slider.value[1])

def load_stocks(RSI_value):

    table = hv.Table(technical_data_table[technical_data_table['RSI'].between(RSI_value[0], RSI_value[1])])
    table = table.opts(opts.Table(width=700))
    return table        

dmap = hv.DynamicMap(load_stocks, kdims='RSI_value').redim.range(RSI_value = ((0, 100),(0,100)))

Any suggestion?

Sander van den Oord
  • 10,986
  • 5
  • 51
  • 96
Vasconni
  • 33
  • 1
  • 5

1 Answers1

0

I think you need to use the depends decorator to tell load_stocks() that RSI_value comes from the slider. See the 'Reactive Functions' section here. Something like:

@pn.depends(RSI_value)  #I added this line to your code
def load_stocks(RSI_value):