plotly / plotly/react-plotly.js

Custom ModeBar Button click uses old state values

Open
#279 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
1.1k
Forks
138
Avg merge
3d 2h
Merged PRs (30d)
4

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the custom ModeBar button configuration and the React Plot component that receives chartState and chartData. Reproduce the click after chartData updates, then trace what values the callback and chart div expose; done means the callback reports the current state and data rather than the values from initialization.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
data-visualization, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.