Plotly.js - Update plot.json data with given dataset

Hi all,

SUMMARY: Is there a way to input Plotly.js with a dataset structured like the one in the web editor ( to update a graph entire configuration?

I’ve spent the last week googleing for an answer to my problem, but i couldn’t find nothing so I’ve created a forum account just to seek help here :frowning:

Here’s my issue:

  • I have the .json file containing the entire plotly graph configuration (the one you receive when using the “export” functionality on
  • I also have a .json file, given from my API, containing the list of data that I need to draw the graph. The structure of the json is the same of the one present in the web editor.

currently I’m manually updating the data within the JSON. In short, for each trace:

  1. I look for the column names (traces.meta.columnNames.x/y),
  2. I clear data for that column name
  3. I search that name in my API .json,
  4. if that name is indeed in my API .json, I push that variableName data in the graph .json configuration column name
  5. The same process is then repeated for layout (minX, maxX, minY, maxY, etc…) and every transform(avg, sum, split, etc…)