Black Lives Matter. Please consider donating to Black Girls Code today.

How to avoid dcc.Graph redraw when i change the slider, does it have simple way?

how to avoid dcc.Graph of plotly scattergeo redraw …when i change the slider, does it have simple way?

This isn’t supported right now but it will be in the future natively.

I create a dcc for relayout graph, and it’s easy to use :laughing:

2 Likes

Nice! I’ve also created an issue for this in the Plotly.js repo that will make this easier to implement in the Graph.react.js component: https://github.com/plotly/plotly.js/issues/1850.

On using mydcc.Relayout & dcc.Graph 's clickData together makes the page crash.

import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output, Event, State
import mydcc

app = dash.Dash()
app.layout = html.Div([
    mydcc.Relayout( id = "rrr", aim = 'graph' ),
    dcc.Graph( id = 'graph',
               figure = { 'data': [  {'x': [1, 2, 3], 'y': [4, 1, 2]}  ]  }
              ),
    dcc.Input(id = 'in',
              placeholder = 'Enter a title ...',
              type = 'text',
              value = ''  
              ),
    html.Div('xxx',id='view')
])

@app.callback(
    Output('rrr', 'layout'),
    [Input('in', 'value')])
def myfun(x):
    return {'title':x}


@app.callback(
    Output('view', 'children'),
    [Input('graph', 'clickData')])
def bStoreEditor(clickData):
    print(clickData)
    return 'yyy'



if __name__ == '__main__':
    app.run_server(debug=True)

… for some reason it render again and again, I will try how to improve it @@

The problem fixed in version 0.1.22.
thanks for your feedback :laughing: