docs(meter): update according to d00dd4b10
This commit is contained in:
@@ -11,47 +11,44 @@ The Meter widget can visualize data in very flexible ways. In can show arcs, nee
|
|||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
### Add a scale
|
### Scale
|
||||||
|
|
||||||
First a *Scale* needs to be added to the Meter with `lv_meter_scale_t * scale = lv_meter_add_scale(meter)`.
|
The Scale has minor and major ticks, and labels on the major ticks.
|
||||||
The Scale has minor and major ticks and labels on the major ticks. Later indicators (needles, arcs, tick modifiers) can be added to the meter
|
|
||||||
|
|
||||||
Any number of scales can be added to Meter.
|
The minor tick lines can be configured with: `lv_meter_set_scale_ticks(meter, tick_count, line_width, tick_length, ctick_olor)`.
|
||||||
|
|
||||||
The minor tick lines can be configured with: `lv_meter_set_scale_ticks(meter, scale, tick_count, line_width, tick_length, ctick_olor)`.
|
To show major tick lines use `lv_meter_set_scale_major_ticks(meter, nth_major, tick_width, tick_length, tick_color, label_gap)`. `nth_major` to specify how many minor ticks to skip to draw a major tick.
|
||||||
|
|
||||||
To add major tick lines use `lv_meter_set_scale_major_ticks(meter, scale, nth_major, tick_width, tick_length, tick_color, label_gap)`. `nth_major` to specify how many minor ticks to skip to draw a major tick.
|
|
||||||
|
|
||||||
Labels are added automatically on major ticks with `label_gap` distance from the ticks with text proportionally to the values of the tick line.
|
Labels are added automatically on major ticks with `label_gap` distance from the ticks with text proportionally to the values of the tick line.
|
||||||
|
|
||||||
`lv_meter_set_scale_range(meter, scale, min, max, angle_range, rotation)` sets the value and angle range of the scale.
|
`lv_meter_set_scale_range(meter, min, max, angle_range, rotation)` sets the value and angle range of the scale.
|
||||||
|
|
||||||
### Add indicators
|
### Add indicators
|
||||||
|
|
||||||
Indicators need to be added to a Scale and their value is interpreted in the range of the Scale.
|
Indicators can be added to meter and their value is interpreted in the range of the scale.
|
||||||
|
|
||||||
All the indicator add functions return `lv_meter_indicator_t *`.
|
All the indicator add functions return an `lv_meter_indicator_t *`.
|
||||||
|
|
||||||
#### Needle line
|
#### Needle line
|
||||||
|
|
||||||
`indic = lv_meter_add_needle_line(meter, scale, line_width, line_color, r_mod)` adds a needle line to a Scale. By default, the length of the line is the same as the scale's radius but `r_mod` changes the length.
|
`indic = lv_meter_add_needle_line(meter, line_width, line_color, r_mod)` adds a needle line to a Scale. By default, the length of the line is the same as the scale's radius but `r_mod` changes the length.
|
||||||
|
|
||||||
`lv_meter_set_indicator_value(meter, indic, value)` sets the value of the indicator.
|
`lv_meter_set_indicator_value(meter, indic, value)` sets the value of the indicator.
|
||||||
|
|
||||||
#### Needle image
|
#### Needle image
|
||||||
|
|
||||||
`indic = lv_meter_add_needle_img(meter, scale, img_src, pivot_x, pivot_y)` sets an image that will be used as a needle. `img_src` should be a needle pointing to the right like this `-O--->`.
|
`indic = lv_meter_add_needle_img(meter, img_src, pivot_x, pivot_y)` sets an image that will be used as a needle. `img_src` should be a needle pointing to the right like this `-O--->`.
|
||||||
`pivot_x` and `pivot_y` sets the pivot point of the rotation relative to the top left corner of the image.
|
`pivot_x` and `pivot_y` sets the pivot point of the rotation relative to the top left corner of the image.
|
||||||
|
|
||||||
`lv_meter_set_indicator_value(meter, inidicator, value)` sets the value of the indicator.
|
`lv_meter_set_indicator_value(meter, inidicator, value)` sets the value of the indicator.
|
||||||
|
|
||||||
#### Arc
|
#### Arc
|
||||||
`indic = lv_meter_add_arc(meter, scale, arc_width, arc_color, r_mod)` adds and arc indicator. . By default, the radius of the arc is the same as the scale's radius but `r_mod` changes the radius.
|
`indic = lv_meter_add_arc(meter, arc_width, arc_color, r_mod)` adds and arc indicator. . By default, the radius of the arc is the same as the scale's radius but `r_mod` changes the radius.
|
||||||
|
|
||||||
`lv_meter_set_indicator_start_value(meter, indic, value)` and `lv_meter_set_indicator_end_value(meter, inidicator, value)` sets the value of the indicator.
|
`lv_meter_set_indicator_start_value(meter, indic, value)` and `lv_meter_set_indicator_end_value(meter, inidicator, value)` sets the value of the indicator.
|
||||||
|
|
||||||
#### Scale lines (ticks)
|
#### Scale lines (ticks)
|
||||||
`indic = lv_meter_add_scale_lines(meter, scale, color_start, color_end, local, width_mod)` adds an indicator that modifies the ticks lines.
|
`indic = lv_meter_add_scale_lines(meter, color_start, color_end, local, width_mod)` adds an indicator that modifies the ticks lines.
|
||||||
If `local` is `true` the ticks' color will be faded from `color_start` to `color_end` in the indicator's start and end value range.
|
If `local` is `true` the ticks' color will be faded from `color_start` to `color_end` in the indicator's start and end value range.
|
||||||
If `local` is `false` `color_start` and `color_end` will be mapped to the start and end value of the scale and only a "slice" of that color gradient will be visible in the indicator's start and end value range.
|
If `local` is `false` `color_start` and `color_end` will be mapped to the start and end value of the scale and only a "slice" of that color gradient will be visible in the indicator's start and end value range.
|
||||||
`width_mod` modifies the width of the tick lines.
|
`width_mod` modifies the width of the tick lines.
|
||||||
|
|||||||
Reference in New Issue
Block a user