SliderGrid
SliderGrid <: Block
A grid of horizontal Slider
s, where each slider has one name label on the left, and a value label on the right.
Each NamedTuple
you pass specifies one Slider
. You always have to pass range
and label
, and optionally a format
for the value label. Beyond that, you can set any keyword that Slider
takes, such as startvalue
.
The format
keyword can be a String
with Format.jl style, such as "{:.2f}Hz", or a function.
Constructors
SliderGrid(fig_or_scene, nts::NamedTuple...; kwargs...)
Examples
sg = SliderGrid(fig[1, 1],
(label = "Amplitude", range = 0:0.1:10, startvalue = 5),
(label = "Frequency", range = 0:0.5:50, format = "{:.1f}Hz", startvalue = 10),
(label = "Phase", range = 0:0.01:2pi,
format = x -> string(round(x/pi, digits = 2), "π"))
)
Working with slider values:
on(sg.sliders[1].value) do val
# do something with `val`
end
Attributes
(type ?SliderGrid.x
in the REPL for more information about attribute x
)
alignmode
, halign
, height
, tellheight
, tellwidth
, valign
, value_column_width
, width
The column with the value labels is automatically set to a fixed width, so that the layout doesn't jitter when sliders are dragged and the value labels change their widths. This width is chosen by setting each slider to a few values and recording the maximum label width. Alternatively, you can set the width manually with attribute value_column_width
.
using GLMakie
fig = Figure()
ax = Axis(fig[1, 1])
sg = SliderGrid(
fig[1, 2],
(label = "Voltage", range = 0:0.1:10, format = "{:.1f}V", startvalue = 5.3),
(label = "Current", range = 0:0.1:20, format = "{:.1f}A", startvalue = 10.2),
(label = "Resistance", range = 0:0.1:30, format = "{:.1f}Ω", startvalue = 15.9),
width = 350,
tellheight = false)
sliderobservables = [s.value for s in sg.sliders]
bars = lift(sliderobservables...) do slvalues...
[slvalues...]
end
barplot!(ax, bars, color = [:yellow, :orange, :red])
ylims!(ax, 0, 30)
fig
Attributes
alignmode
Defaults to Inside()
The align mode of the block in its parent GridLayout.
halign
Defaults to :center
The horizontal alignment of the block in its suggested bounding box.
height
Defaults to Auto()
The height setting of the block.
tellheight
Defaults to true
Controls if the parent layout can adjust to this block's height
tellwidth
Defaults to true
Controls if the parent layout can adjust to this block's width
valign
Defaults to :center
The vertical alignment of the block in its suggested bounding box.
value_column_width
Defaults to automatic
The width of the value label column. If automatic
, the width is determined by sampling a few values from the slider ranges and picking the largest label size found.
width
Defaults to Auto()
The width setting of the block.
These docs were autogenerated using Makie: v0.20.10, GLMakie: v0.9.11, CairoMakie: v0.11.12, WGLMakie: v0.9.10