Skip to content

Update plot with AJAX #2

@josephernest

Description

@josephernest

Thanks and congrats @alanjones2 for this great tutorial, about how to use Plotly directly with Flask + AJAX!

Small question: why do you create a new plot on each update after an AJAX call?

https://github.com/alanjones2/Flask-Plotly/blob/main/plotcallback-gm2/templates/chartsajax.html#L10

function cb(selection) {
            $.getJSON({
                url: "/callback", data: { 'data': selection }, success: function (result) {
                    Plotly.newPlot('chart', result, {});;
                }
            });
        }

Isn't there a way to do something else than newPlot, but rather "update plot data"?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions