1.. _lv_line: 2 3============== 4Line (lv_line) 5============== 6 7Overview 8******** 9 10The Line Widget is capable of drawing straight lines between a set of 11points. 12 13.. _lv_line_parts_and_styles: 14 15Parts and Styles 16**************** 17 18- :cpp:enumerator:`LV_PART_MAIN` uses the :ref:`typical background <typical bg props>` 19 and line style properties. 20 21.. _lv_line_usage: 22 23Usage 24***** 25 26Set points 27---------- 28 29A Line's points have to be stored in an :cpp:struct:`lv_point_precise_t` array and passed to 30the Widget by the :cpp:expr:`lv_line_set_points(lines, point_array, point_cnt)` 31function. 32 33Their coordinates can either be specified as raw pixel coordinates 34(e.g. ``{5, 10}``), or as a percentage of the Line's bounding box using 35:cpp:expr:`lv_pct(x)`. In the latter case, the Line's width/height may need to 36be set explicitly using :cpp:func:`lv_obj_set_width` and :cpp:func:`lv_obj_set_height`, 37as percentage values do not automatically expand the bounding box. 38 39Auto-size 40--------- 41 42By default, the Line's width and height are set to :c:macro:`LV_SIZE_CONTENT`. 43This means it will automatically set its size to fit all the points. If 44the size is set explicitly, parts on the Line may not be visible. 45 46Invert y 47-------- 48 49By default, the *y == 0* point is in the top of the Widget. It might be 50counter-intuitive in some cases so the y coordinates can be inverted 51with :cpp:expr:`lv_line_set_y_invert(line, true)`. In this case, *y == 0* will 52be at the bottom of the Widget. *y invert* is disabled by default. 53 54 55 56.. _lv_line_events: 57 58Events 59****** 60 61Only :ref:`generic events <events>` are sent by Line Widgets. 62 63.. admonition:: Further Reading 64 65 Learn more about :ref:`lv_obj_events` emitted by all Widgets. 66 67 Learn more about :ref:`events`. 68 69 70 71.. _lv_line_keys: 72 73Keys 74**** 75 76No *Keys* are processed by Line Widgets. 77 78.. admonition:: Further Reading 79 80 Learn more about :ref:`indev_keys`. 81 82 83 84.. _lv_line_example: 85 86Example 87******* 88 89.. include:: ../../examples/widgets/line/index.rst 90 91 92 93.. _lv_line_api: 94 95API 96*** 97