You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.5 KiB
C
39 lines
1.5 KiB
C
#include "../../lv_examples.h"
|
|
#if LV_USE_METER && LV_BUILD_EXAMPLES
|
|
|
|
/**
|
|
* Create a pie chart
|
|
*/
|
|
void lv_example_meter_4(void)
|
|
{
|
|
lv_obj_t * meter = lv_meter_create(lv_scr_act());
|
|
|
|
/*Remove the background and the circle from the middle*/
|
|
lv_obj_remove_style(meter, NULL, LV_PART_MAIN);
|
|
lv_obj_remove_style(meter, NULL, LV_PART_INDICATOR);
|
|
|
|
lv_obj_set_size(meter, 200, 200);
|
|
lv_obj_center(meter);
|
|
|
|
/*Add a scale first with no ticks.*/
|
|
lv_meter_scale_t * scale = lv_meter_add_scale(meter);
|
|
lv_meter_set_scale_ticks(meter, scale, 0, 0, 0, lv_color_black());
|
|
lv_meter_set_scale_range(meter, scale, 0, 100, 360, 0);
|
|
|
|
/*Add a three arc indicator*/
|
|
lv_coord_t indic_w = 100;
|
|
lv_meter_indicator_t * indic1 = lv_meter_add_arc(meter, scale, indic_w, lv_palette_main(LV_PALETTE_ORANGE), 0);
|
|
lv_meter_set_indicator_start_value(meter, indic1, 0);
|
|
lv_meter_set_indicator_end_value(meter, indic1, 40);
|
|
|
|
lv_meter_indicator_t * indic2 = lv_meter_add_arc(meter, scale, indic_w, lv_palette_main(LV_PALETTE_YELLOW), 0);
|
|
lv_meter_set_indicator_start_value(meter, indic2, 40); /*Start from the previous*/
|
|
lv_meter_set_indicator_end_value(meter, indic2, 80);
|
|
|
|
lv_meter_indicator_t * indic3 = lv_meter_add_arc(meter, scale, indic_w, lv_palette_main(LV_PALETTE_DEEP_ORANGE), 0);
|
|
lv_meter_set_indicator_start_value(meter, indic3, 80); /*Start from the previous*/
|
|
lv_meter_set_indicator_end_value(meter, indic3, 100);
|
|
}
|
|
|
|
#endif
|