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

ValueDescription
horizontal_topTicks on top
horizontal_bottomTicks on bottom
vertical_leftTicks on left
vertical_rightTicks on right
round_innerCircular, ticks inside
round_outerCircular, 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.

PartDescription
mainThe 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).
itemsThe minor ticks (always drawn as lines): line properties; length sets the tick length and radial_offset shifts them on round scales.
indicatorThe 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.

PropertyTypeDescription
modeenum:lv_scale_modeSet the scale mode
total_tick_countintSet number of ticks
major_tick_everyintSet frequency of major ticks
label_showboolShow or hide labels
min_valueintSet minimum value
max_valueintSet maximum value
angle_rangedegSet angular range (degrees)
rotationdegRotate the scale (degrees)
text_srcstring[NULL]Set custom labels from text
post_drawboolEnable post-draw events
draw_ticks_on_topboolDraw ticks above other content

<lv_scale-section>

Add a styled section

access add · returns lv_scale_section

NameKindTypeDescription
min_valuepropintSet section min
max_valuepropintSet section max
style_mainpropstyleSet main line style
style_indicatorpropstyleSet major line and text style
style_itemspropstyleSet minor ticks' style
bind_min_valuepropsubjectBind section min to subject
bind_max_valuepropsubjectBind section max to subject

Last updated on

On this page