How to set point of chart to picture

Important: unclear posts may not receive useful answers.

Before posting

  • Get familiar with Markdown to format and structure your post
  • Be sure to update lvgl from the latest version from the master branch.
  • Be sure you have checked the FAQ and read the relevant part of the documentation.
  • If applicable use the Simulator to eliminate hardware related issues.

Delete this section if you read and applied the mentioned points.

Description

I want to use img to the point of chart . But so far I have no idea about how to get point object (lv_obj_t*).

What MCU/Processor/Board and compiler are you using?

stm32

What LVGL version are you using?

v8.3

What do you want to achieve?

change the point’s picture

What have you tried so far?

Code to reproduce

Screenshot and/or video

You can do it by using a bg_img.

I had a mouse cursor icon in my project so I used that as an example :slight_smile:


    LV_IMG_DECLARE(mouse_cursor_icon);
    lv_obj_set_style_bg_img_src(chart, &mouse_cursor_icon, LV_PART_INDICATOR);
    lv_obj_set_style_size(chart, 20, 20, LV_PART_INDICATOR);   /*Be sure the point is large enough for the image*/
    lv_obj_set_style_bg_opa(chart, 0, LV_PART_INDICATOR);  /*Make the background transparent*/

image

2 Likes