Skip to content

Custom ModeBar Button click uses old state values #279

Open
@joshuakoh1

Description

@joshuakoh1
modeBarButtonsToAdd: [{ name: 'customDownload', title: 'Download', icon: Plotly.Icons.disk, click: (div) => {console.log(div); console.log(chartState); console.log(chartData); } }

chartState is the Plotly state variable passed to the Plot element (data, layout, frames, config)
chartData is the raw data source that is used to generate the data traces for chartState
chartData gets updated during app cycle which updates chartState
All of the data outputs from click event are logged as point of init which has an empty data array, even the chart div that gets passed from the click function

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions