Linking / callbacks not working in Holoviz / Panel dashboards

298 Views Asked by At

Linking doesn't appear to be working. I create a dashboard or linked widget (code samples below) and I change a value in a drop down and nothing appears to happen. I'm expecting the "linked code" to be called but instead, nothing appears to happen at all. Print statements do not show and output in the UI does not change. What am I missing?

I have followed the docs but these do not working on several different machines i have been on.

Creating an automatic dashboard not working

First render works fine, but then changing the drop down does nothing.

import panel as pn
import pandas as pd
from datetime import date, datetime, timedelta
import param
import holoviews as hv

hv.extension('plotly')

regions = ['United States of America', 'Greater China', 'Japan']

class DashboardTest(param.Parameterized):
    region = param.Selector(default='Japan', objects=regions)

    @param.depends('region')
    def on_update(self):

        print(f'on_update: {datetime.now()}')
        
        return pn.pane.Markdown(f"""
                # Chart Updated: {datetime.now()}
                
                region: {self.region}                         
        """)

explorer = DashboardTest()
row = pn.Row(
    pn.Column(explorer.param),
    explorer.on_update
)
row

Example

Basic linking not working

This is copied directly from the docs site on linking. Again, first render works fine but changing the text does not cause the output to change.

markdown = pn.pane.Markdown("Some text")
text_input = pn.widgets.TextInput(value=markdown.object)

text_input.link(markdown, value='object')

pn.Row(text_input, markdown)
1

There are 1 best solutions below

0
will On

I figured it out. I wasn't calling:


pn.extension()