Toggle
|
The page is in the process of being translated. |
A toggle with an attribute active that can either be true or false, to enable or disable properties of an interactive plot.
using GLMakie
fig = Figure()
ax = Axis(fig[1, 1], limits = (0, 600, -2, 2))
hidexdecorations!(ax)
t = Observable(0.0)
points = lift(t) do t
x = range(t-1, t+1, length = 500)
@. sin(x) * sin(2x) * sin(4x) * sin(23x)
end
lines!(ax, points, color = (1:500) .^ 2, linewidth = 2, colormap = [(:blue, 0.0), :blue])
gl = GridLayout(fig[2, 1], tellwidth = false)
Label(gl[1, 1], "Live Update")
toggle = Toggle(gl[1, 2], active = false)
on(fig.scene.events.tick) do tick
toggle.active[] || return
t[] += tick.delta_time
end
fig
Attributes
framecolor_active
Defaults to COLOR_ACCENT_DIMMED[]
The color of the border when the toggle is hovered.
framecolor_inactive
Defaults to RGBf(0.94, 0.94, 0.94)
The color of the border when the toggle is inactive.
height
Defaults to Auto()
The height of the bounding box. Use length and markersize to set the dimensions of the toggle.