Adding Custom buttons to dcc.Graph modebar


I’m trying to add new button to the modebar using config options in dcc.Graph. However, the plot is not displayed properly in the web page.

tried looking at the browser console, got this:

Code I’m using:

dcc.Graph(config={'modeBarButtonsToAdd': [{
                             'name': 'test',
                             'icon': 'Plotly.Icons.disk',
                             'title': 'Export Chart Data',
                             'click': 'function(){window.alert();}'

Could someone help me with this please? sadly I have no exposure to javascript.


Hi @blabberbox,

Could you move this question to the “Dash” forum cateogry (rather than “API/Python”)? Thanks!


Sure Jon, I thought it was an issue of exposing the js configs through python. have updated it.

Any headway on this? I’m also trying to add modeBar customization through Python.

Hi guys. Is there any progress here?I have to add my button in modebar.