Panel streamz pane customization

From Streamz docs " The Streamz pane uses the default panel resolution to figure out the appropriate way to render the object returned by a Stream".

Lets say the Stream returns JSON object, then the Streamz pane will render JSON, I would like to be able to pass options to the JSON pane. Is there a way to do that?

1 Like

Hi @abdamj

If the options are fixed you can just provide them to the Streamz pane I believe.

If not you can return the specific Panel you want instantiated with the parameters you want.

For example

import json
from numpy import random
import panel as pn
from streamz import Stream
from datetime import datetime

stream = Stream()

value = 0
obj = {}

def update(obj):
    return pn.pane.JSON(
        json.dumps(obj), name="JSON", depth=2, sizing_mode="stretch_width",

streamz_pane = pn.pane.Streamz(, always_watch=True, width=500)

def emit():
    global value
    value += 1
    global obj
    obj[str(datetime.utcnow())] = random.random()

pn.state.add_periodic_callback(emit, period=250, count=50)


which looks like

1 Like

@abdamj. Checkout this example also Streaming example. I was quite surprised how easy it was to create.

1 Like

thanks a lot for the pointers, i was able to solve the issue :slight_smile:

1 Like