# WGLMakie zoom with export\_static

**URL:** <https://discourse.julialang.org/t/wglmakie-zoom-with-export-static/126585>\
**Category:** Visualization\
**Tags:** question\
**Created:** [March 5, 2025, 2:02pm UTC](https://discourse.julialang.org/t/wglmakie-zoom-with-export-static/126585 "2025-03-05T14:02:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![bjarthur](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bjarthur/32/9638_2.png) [@bjarthur](https://discourse.julialang.org/u/bjarthur)\
**Post date:** [March 5, 2025, 2:02pm UTC](https://discourse.julialang.org/t/wglmakie-zoom-with-export-static/126585/1 "2025-03-05T14:02:25Z")

</div>

when a WGLMakie App is served with Bonito, zooming in on a plot works, but when a standalone .html file is created with `export_static`, it doesn’t. presumably a Julia server is needed for this functionality.

i post because i’m curious what it would take to get this to work. is there a workaround like for [DataInspector](https://docs.makie.org/stable/explanations/backends/wglmakie#Offline-Tooltip)? or maybe there is some other [JS code](https://docs.makie.org/stable/explanations/backends/wglmakie#Execute-Javascript-directly) i could execute??

more generally, is there a roadmap for implementing more of WGLMakie in javascript and finalizing the API so that it is no longer experimental? doing so is a bit outside my expertise but i’d be happy to help with some guidance. [Gadfly’s support for interactive standalone SVGs](https://gadflyjl.org/stable/tutorial/#Interactivity) is a killer feature and the sole reason i sometimes use it instead of Makie.

```julia
using WGLMakie, Bonito

app = App() do session
    fig, ax, sc = scatter(rand(10), rand(10))

    return DOM.div(fig)
end

export_static("mwe.html", app) # zoom doesn't work :(
Bonito.Server(app, "0.0.0.0", 80) # zoom does work :)

```

---

<div class="post-metadata">

**Author:** ![sdanisch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sdanisch/32/1406_2.png) [@sdanisch](https://discourse.julialang.org/u/sdanisch)\
**Post date:** [March 5, 2025, 4:45pm UTC](https://discourse.julialang.org/t/wglmakie-zoom-with-export-static/126585/2 "2025-03-05T16:45:38Z")

</div>

Just answered this recently:

> [@DataInspector + bonito](https://discourse.julialang.org/t/datainspector-bonito/126249/4):
>
> Hm not easily… Although, it’s not that difficult to implement a simple on scroll event, which modifies the camera matrix of the axis scene directly in Javascript: function attach\_js\_zoom(scene) return js""" // I need to improve the $(scene) operation, to do the below: function get\_scene() { return new Promise(resolve =\> (function check() { $(scene).then(scene =\> scene ? resolve(scene) : setTimeout(check, 50)); })()); } …

---

<div class="post-metadata">

**Author:** ![bjarthur](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bjarthur/32/9638_2.png) [@bjarthur](https://discourse.julialang.org/u/bjarthur)\
**Post date:** [March 5, 2025, 6:58pm UTC](https://discourse.julialang.org/t/wglmakie-zoom-with-export-static/126585/3 "2025-03-05T18:58:26Z")

</div>

so that makes three of us that really want to zoom and pan on a static plot. i do have a little bit of time to dabble if you can guide me even further. as is, zooming the entire scene like that is not useful. a couple questions:

1. how would you architect a solution to put that code inside WGLMakie so that it just worked out-of-the-box for everyone?
2. in a non-static (ie with a julia server) plot, one can programmatically zoom by calling `limits!`. can one call that function from within javascript? equivalently, i know you can pass an observable’s value from julia to javascript, but is there a way to set an observable’s value from within javascript? if so, that could provide a means to zoom.

---

<div class="post-metadata">

**Author:** ![sdanisch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sdanisch/32/1406_2.png) [@sdanisch](https://discourse.julialang.org/u/sdanisch)\
**Post date:** [March 6, 2025, 1:45pm UTC](https://discourse.julialang.org/t/wglmakie-zoom-with-export-static/126585/4 "2025-03-06T13:45:59Z")

</div>

> [@bjarthur](#):
>
> how would you architect a solution to put that code inside WGLMakie so that it just worked out-of-the-box for everyone?

I can worry about that, once we have something usable 😉

> can one call that function from within javascript

No, that’s all implemented in Julia, so not available in a pure javascript export.  
Otherwise this would be a piece of cake 😉

> but is there a way to set an observable’s value from within javascript

Yes, there is, but with the Julia side of things missing, it won’t get you very far 😉

---

<div class="post-metadata">

**Author:** ![ConnectedSystems](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/connectedsystems/32/16815_2.png) [@ConnectedSystems](https://discourse.julialang.org/u/ConnectedSystems)\
**Post date:** [March 7, 2025, 11:01pm UTC](https://discourse.julialang.org/t/wglmakie-zoom-with-export-static/126585/5 "2025-03-07T23:01:56Z")

</div>

I’m also at the state where I would really like to see this functionality in WGLMakie.

I’ve joined to discussion here on it to see where I can help, although my JavaScript is a little rusty and my knowledge of Makie internals is limited.

> **[\[Roadmap\] WGLMakie · MakieOrg Makie.jl · Discussion #4248](https://github.com/MakieOrg/Makie.jl/discussions/4248)**
>
> Serverless visualization JSServe + WGLMakie already work pretty well with a running Julia server, but this doesn't scale very well to serve interactive demos for thousands of people (e.g. blogpost/...
