Skip to content

GroupTherapyOrg/WasmPlot.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WasmPlot.jl

Canvas2D Plotting. Makie API. Compiled to WebAssembly.

A plotting library with Makie-compatible API that compiles to WasmGC via WasmTarget.jl. All chart logic — layout, ticks, data transforms, rendering — runs as WebAssembly in the browser via Canvas2D imports.

CI License: MIT

Quick Start

using WasmPlot

fig = Figure(size=(800, 500))
ax = Axis(fig[1, 1]; xlabel="x", ylabel="y", title="sin & cos")

x = range(0, 2pi, 200)
lines!(ax, x, sin.(x); color=:blue, linewidth=2)
lines!(ax, x, cos.(x); color=:orange, linestyle=:dash)

render!(fig)  # emits Canvas2D draw calls

Plot Types

Type Function Status
Line lines!(ax, x, y) Solid, dash, dot styles
Scatter scatter!(ax, x, y) Circle markers
Bar barplot!(ax, x, heights) Makie width algorithm
Heatmap heatmap!(ax, ...) Viridis colormap

Architecture

Julia code (WasmGC)
  Figure → Axis → Plot structs
  compute_viewport, compute_ticks, data_to_pixel
    ↓
  Canvas2D import stubs (21 functions)
    ↓
  JS glue (~30 one-liner wrappers)
    ↓
  Browser Canvas2D (GPU-accelerated)

All types compile to WasmGC structs. Verified by 112 tests: 69 unit + 11 WASM compilation + 32 Julia-to-WASM e2e parity.

Integration with Therapy.jl

WasmPlot is designed for use inside Therapy.jl @island components. Canvas2D imports are auto-registered in the compilation pipeline.

Makie Parity

Everything provided matches Makie defaults: Wong color cycle, axis padding (5%), bar gap (0.2), tick algorithm (1-2-5 rule), markersize (9px diameter), grid/spine styling. See the parity audit.

About

Canvas2D plotting with Makie-compatible API, compiled to WasmGC

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages