Change width of lv_arc widget?

Hello

Is it possible to change the width of the lv_arc widget, see screenshot below.

Thank you

image

Hi @epikao ,

This following should work for you, note you need to change the MAIN and INDICATOR parts respectively:

    lv_obj_t * arc = lv_arc_create(lv_scr_act());
    lv_obj_set_size(arc, 150, 150);
    lv_arc_set_rotation(arc, 135);
    lv_obj_set_style_arc_width(arc, 25, LV_PART_MAIN); // Changes background arc width
    lv_obj_set_style_arc_width(arc, 25, LV_PART_INDICATOR); // Changes set part width 
    lv_arc_set_bg_angles(arc, 0, 270);
    lv_arc_set_value(arc, 10);
    lv_obj_center(arc);

Hope that helps…

Kind Regards,

Pete

just another question: Is it also possible to add a border, as screenshot below ?

image

Hi @epikao ,

Looking through the source code I can’t see any evidence to suggest this has been implemented at this point in the library. I suspect the complexity and extra CPU load required to add this functionality might be considered too much for a micro controller environment… (Just my thought)

You can set a border on the KNOB part if that is helpful as follows:

    lv_obj_set_style_outline_width(arc, 1, LV_PART_KNOB);

With this result:
arc

I hope that helps…

Kind Regards,

Pete

ok thank you very much, therefore i will create the border with a background image

1 Like