JuliaPlots / JuliaPlots/PlotlyJS.jl

update plot in Dash with asynchronous data

Open
#412 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
444
Forks
86
PR merge metrics
No merged PRs in 30d

Description

I can update the data in a plot using
```
using PlotlyJS

function data_producer(pl)
while true
extendtraces!(pl, Dict(:y => [[randn()]]))
sleep(1)
end
end
plt = plot(scatter(; y = randn(10)))
task = @async data_producer(plt)
```

but the following code using Dash does not update the plot:
```
using Dash, DashHtmlComponents, DashCoreComponents, PlotlyBase

app = dash()

plt = Plot(scatter(; y = randn(10)))

function data_producer(pl)
while true
extendtraces!(pl, Dict(:y => [[randn()]]))
sleep(1)
end
end
task = @async data_producer(plt)

app.layout = html_div() do
dcc_graph(id = "figure", figure = plt)
end

run_server(app, "127.0.0.1", 8050, debug = true)
```

Ref: https://discourse.julialang.org/t/update-plotlyjs-plot-in-dash-with-async-data/66298

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.