Arc Label (lv_arclabel)

The Arc Label is a specialized widget designed to display text along an arc. It allows for flexible text placement and styling, making it suitable for applications where text needs to follow a curv...

Edit on GitHub

Overview

The Arc Label is a specialized widget designed to display text along an arc. It allows for flexible text placement and styling, making it suitable for applications where text needs to follow a curved path, such as in gauges, dials, or custom interfaces. The widget supports various configurations, including text alignment, direction, radius adjustment, and color customization.

Parts and Styles

  • LV_PART_MAIN Represents the main part of the Arc Label, including the arc path and the text rendered along it. The appearance of the text and the arc can be customized using typical text and background style properties.

Usage

Text Management

Angle Configuration

Direction

Specify the text direction along the arc using lv_arclabel_set_dir(arclabel, LV_ARCLABEL_DIR_CLOCKWISE) or lv_arclabel_set_dir(arclabel, LV_ARCLABEL_DIR_COUNTERCLOCKWISE).

  • LV_ARCLABEL_DIR_CLOCKWISE Text flows in a clockwise direction along the arc.
  • LV_ARCLABEL_DIR_COUNTERCLOCKWISE Text flows in a counter-clockwise direction along the arc.

Alignment

Adjust vertical text alignment with lv_arclabel_set_text_vertical_align(arclabel, LV_ARCLABEL_TEXT_ALIGN_CENTER). Set horizontal alignment using lv_arclabel_set_text_horizontal_align(arclabel, LV_ARCLABEL_TEXT_ALIGN_CENTER).

Both vertical and horizontal use the same logic.

Radius and Center Offset

Color and Recoloring

Enable text recoloring with lv_arclabel_set_recolor(arclabel, true). This allows parts of the text to be colored differently using color commands embedded in the text string.

Interactive Behavior

By default, Arc Label is not clickable. To make it interactive, you would need to add custom event handling, as it does not inherit clickability by default.

Events

The Arc Label primarily inherits events from the base object class. It does not define specific events beyond those common to all widgets. You can attach custom event handlers to respond to interactions if needed.

Keys

The Arc Label does not define specific key bindings beyond those inherited from the base object class. Keyboard navigation and interaction would require additional implementation.

Example

Simple Arc Label

API

How is this guide?

Last updated on

On this page