Scale (lv_scale)
A linear or circular scale with ticks, labels, ranges and sections.
Overview
The Scale draws a linear or circular scale with a configurable range, tick counts and placement, optional labels, and styled sections for highlighting sub-ranges.
Learn more in the LVGL Open documentation.
Enumerations
lv_scale_mode — How the scale is drawn
| Value | Description |
|---|---|
horizontal_top | Ticks on top |
horizontal_bottom | Ticks on bottom |
vertical_left | Ticks on left |
vertical_right | Ticks on right |
round_inner | Circular, ticks inside |
round_outer | Circular, ticks outside |
Properties
Parts
Style parts of the widget with local style (e.g. style_bg_color-knob="0xff0000") or with style sheets (e.g. <style name="style_knob" selector="knob">). See Styles to learn more.
| Part | Description |
|---|---|
main | The main rail: on straight scales a line (line_color, line_width, line_opa, line_rounded); on round scales an arc (arc_color, arc_width, arc_opa, arc_rounded, arc_image_src). |
items | The minor ticks (always drawn as lines): line properties; length sets the tick length and radial_offset shifts them on round scales. |
indicator | The major ticks and their labels: line properties for the ticks (length, radial_offset) plus text properties for the labels; pad_radial sets the label gap. |
Properties below are the widget's XML <api>; see API for how properties, parameters and elements work.
| Property | Type | Description |
|---|---|---|
mode | enum:lv_scale_mode | Set the scale mode |
total_tick_count | int | Set number of ticks |
major_tick_every | int | Set frequency of major ticks |
label_show | bool | Show or hide labels |
min_value | int | Set minimum value |
max_value | int | Set maximum value |
angle_range | deg | Set angular range (degrees) |
rotation | deg | Rotate the scale (degrees) |
text_src | string[NULL] | Set custom labels from text |
post_draw | bool | Enable post-draw events |
draw_ticks_on_top | bool | Draw ticks above other content |
<lv_scale-section>
Add a styled section
access add · returns lv_scale_section
| Name | Kind | Type | Description |
|---|---|---|---|
min_value | prop | int | Set section min |
max_value | prop | int | Set section max |
style_main | prop | style | Set main line style |
style_indicator | prop | style | Set major line and text style |
style_items | prop | style | Set minor ticks' style |
bind_min_value | prop | subject | Bind section min to subject |
bind_max_value | prop | subject | Bind section max to subject |
Last updated on