codelv / enaml-web

Build interactive websites with enaml
https://codelv.com/projects/enaml-web/
MIT License
99 stars 17 forks source link

Plotly example: How to update the graph in an enaml-web way ? #23

Closed youpsla closed 4 years ago

youpsla commented 4 years ago

Do you think it's possible to replace a plotly graph with websocket by just modifyng the traces and display attribute of PlotlyGraph component ? It doesn't works for me. Plotly.js doesn't seems to react when data-traces are modified in the DOM.

Any idea to do that without writing js for collecting all datas from Plotly div attribute and lauching a Plotly.react command ?

frmdstryr commented 4 years ago

Yes, this is currently done in one of my projects so the chart updates when the plot data changes.

When a change occurs on one of the data-tags just rebuild the plot(s) using Plotly.newPlot.

youpsla commented 4 years ago

Thanks for your answer. Then, if I understand well, I have to build a js function listening on data-tags change and launch a Plotly.NewPlot.

By the way I had to change $tag.prop(k,v); to $tag.attr(k,v); for the data-tag to be updated in the DOM (data js(jquery ?) property of the DIV is not updated too with prop)

Again thanks for your many, pleasure to use tools/frameworks.

youpsla commented 4 years ago

Let's go to work ... :-)