I’m working with plotly.py but for some figure manipulation, I’d need plotly.js
As you are about to read, I am very new to js and I’m failing on step 0:
I downloaded plotly.js from Getting started in JavaScript (https://cdn.plot.ly/plotly-2.18.2.min.js) and
saved it to a file.
I have a clientsideCallback
from plotly.py that creates a copy of a figure, that I would want to alter with js.
Creating the figure copy works and it is also returned correctly back to python, when not implementing the “does not work yet” part.
The plotly.js file is in the same directory as this (working) script:
set_fig_copy: function(re_layout, initial_range, fig) {
// create new figure (works)
let newFig = JSON.parse(JSON.stringify(fig));
// does not work yet
import {Plotly} from "./plotly.js";
var update = {
marker.size : 2;
};
Plotly.restyle(newFig, update)
return newFig;
}
Eventually I do not want to set the marker size to 2 but to 50% of what it was before, but that’s another topic. First I would need to know, how to properly import the Plotly class from plotly.js.
How would I do that?