How to retrieve and save edits to chart/axis/legend titles and labels?

I want to be able to add/edit a chart title or axis label on the chart itself and save those changes but I don’t know how to retrieve those changes. I know it involves creating an event listener for event ‘plotly_relayout’ but how can I retrieve the new title or label I just added?

Oh wait I found it. You can find the new layout in the event object in your event callback.

$('#chartContainer').on('plotly_relayout', (e) => { 
    console.log(e.target.layout);
});
1 Like