# Simple example of Interactive + Dynamically Updating (VegaLite) graph with Julia backend

**URL:** https://discourse.julialang.org/t/simple-example-of-interactive-dynamically-updating-vegalite-graph-with-julia-backend/36007
**Category:** Visualization
**Created:** [March 15, 2020, 12:02pm UTC](https://discourse.julialang.org/t/simple-example-of-interactive-dynamically-updating-vegalite-graph-with-julia-backend/36007 "2020-03-15T12:02:49Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![robertfeldt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/robertfeldt/32/239_2.png) [@robertfeldt](https://discourse.julialang.org/u/robertfeldt)
#### Post date: [March 15, 2020, 12:02pm UTC](https://discourse.julialang.org/t/simple-example-of-interactive-dynamically-updating-vegalite-graph-with-julia-backend/36007/1 "2020-03-15T12:02:49Z")

</div>

I’m sure there are many ways this can be done in Julia but if anyone has seen very simple examples of how to produce interactive graphs that can be dynamically updated from (backend) Julia code that would be great?

My starting point is to use something like Interact.jl and VegaLite.jl and then export as a stand-alone html page which the backend can then dynamically stream data to.

Main use case is for interactive control of optimization runs in Optim.jl and BlackBoxOptim.jl. If someone has concrete examples or pointers that would be super-useful. Thanks!

---

<div class="post-metadata">

### Author: ![Skoffer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/skoffer/32/378_2.png) [@Skoffer](https://discourse.julialang.org/u/Skoffer)
#### Post date: [March 15, 2020, 12:19pm UTC](https://discourse.julialang.org/t/simple-example-of-interactive-dynamically-updating-vegalite-graph-with-julia-backend/36007/2 "2020-03-15T12:19:13Z")

</div>

There is  
[https://covid19.opensourc.es](https://covid19.opensourc.es) which has functionality similar to what you want.  
May be @Wikunia can give some advices.

Also, there was an announcement [[ANN] Matte.jl - interactive dashboards written in Julia](https://discourse.julialang.org/t/ann-matte-jl-interactive-dashboards-written-in-julia/35920) it’s somewhat different, cause it doesn’t use interact.jl, but it can possibly solve your original problem.

---

<div class="post-metadata">

### Author: ![Wikunia](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wikunia/32/2180_2.png) [@Wikunia](https://discourse.julialang.org/u/Wikunia)
#### Post date: [March 16, 2020, 3:25pm UTC](https://discourse.julialang.org/t/simple-example-of-interactive-dynamically-updating-vegalite-graph-with-julia-backend/36007/3 "2020-03-16T15:25:58Z")

</div>

I’m not using VegaLite.jl for that but maybe I can give you some help with Vega in general. The documentation is sometimes not the best but I found out some stuff after hours of searching.

---

<div class="post-metadata">

### Author: ![robertfeldt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/robertfeldt/32/239_2.png) [@robertfeldt](https://discourse.julialang.org/u/robertfeldt)
#### Post date: [March 16, 2020, 3:56pm UTC](https://discourse.julialang.org/t/simple-example-of-interactive-dynamically-updating-vegalite-graph-with-julia-backend/36007/4 "2020-03-16T15:56:55Z")

</div>

Thanks, Vega is also fine. Is the source for the covid19 site available or do you have other example code to share?

---

<div class="post-metadata">

### Author: ![Wikunia](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wikunia/32/2180_2.png) [@Wikunia](https://discourse.julialang.org/u/Wikunia)
#### Post date: [March 16, 2020, 6:37pm UTC](https://discourse.julialang.org/t/simple-example-of-interactive-dynamically-updating-vegalite-graph-with-julia-backend/36007/5 "2020-03-16T18:37:30Z")

</div>

This is my current version: [Covid 19 vega · GitHub](https://gist.github.com/Wikunia/427c8d1421ac4370d1e4304a9cca2d34)  
If you are in the slack community you can ask me there if you have questions.

---

<div class="post-metadata">

### Author: ![robertfeldt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/robertfeldt/32/239_2.png) [@robertfeldt](https://discourse.julialang.org/u/robertfeldt)
#### Post date: [March 18, 2020, 3:50pm UTC](https://discourse.julialang.org/t/simple-example-of-interactive-dynamically-updating-vegalite-graph-with-julia-backend/36007/6 "2020-03-18T15:50:04Z")

</div>

I couldn’t really find an example for what I was looking for but thanks to this VegaLite with WebSockets example:

> <https://gist.github.com/domoritz/8e1e4da185e1a32c7e54934732a8d3d5>
>
> There are more than three files. show original

I managed to put together a single Julia file that uses HTTP to serve a frontend html page with a VegaLite graph and then pushes data updates from Julia over a WebSocket to the frontend which then updates the VegaLite graph. Sharing in a single file gist here since it might be useful for others to build on:

> <https://gist.github.com/robertfeldt/96aa0fe4ac2f0eea2c221983a74203dc>
