Change exponentformat of an axis



I’m trying to modify the exponentformat of an axis when the plot is already created.
I’ve tried to use the function Plotly.relayout but it doesn’t work.

var update = {
    "xaxis.exponentformat": "power"
Plotly.relayout(plot, update);

The original exponentformat of the xaxis is set to “E” and when I execute the previous code the exponentformat is changed to the default value “B” so I suppose the function is working but I’m not passing correctly the value.


Here’s a working example:


Thanks for your help. I was binding incorrectly the value of the exponentFormat to the dropdown so I was the relayout function was detecting a change but can’t recognize the value so decide to change it to the default value.

Here I let my code in case someone may be having a similiar issue.

private function setExponentFormat() {
    let changes = {};
    changes[`${this.selectedAxis}.exponentformat`] = "E";
    Plotly.relayout(plot, changes);