Configuration parameter

Hey, Iโ€™m quite new to web development and iโ€™m trying to integrate plotly into my Django app.

The way Iโ€™m currently doing it is by creating a go.Figure(), adding a trace and layout, then converting it .to_html() and sending that to the frontend as a div.

Iโ€™m trying to set a configuration parameter but iโ€™m not sure how to do so, as all the examples I see use the config dictionairy in the .show() function:

fig = go.Figure()

config = {'scrollZoom': True}

fig.add_trace(
    go.Scatter(
        x=[1, 2, 3],
        y=[1, 3, 1]))

fig.show(config=config)

As Iโ€™m not using the .show() function, but converting the figure to an html object instead, how would i go about adding this parameter?

Thanks!

Hi @avimuni welcome to the forums.

I think, you can use the config parameter as kwarg. Did you try?

go.Figure().to_html(config={'scrollZoom': True})

Yes! canโ€™t believe I missed that.
Thanks!

1 Like