Description
What MCU/Processor/Board and compiler are you using?
F1C200S
What do you want to achieve?
In the chart chart, draw a text above the curve and display its value
What have you tried so far?
I use lv_chart_set_next_value to update the curve value and bind the LV_EVENT_DRAW_PART_BEGIN event. In the event processing, I did the following processing, but after calling lv_draw_rect, the text is covered on each curve, which is not what I want. In addition Why is it responding to clicks? I did not set the click event.
Code to reproduce
char buf[16];
lv_snprintf(buf, sizeof(buf), "%d", value);
lv_point_t size;
lv_txt_get_size(&size, buf, LV_FONT_DEFAULT_FORCE, 0, 0, LV_COORD_MAX, LV_TEXT_FLAG_NONE);
lv_area_t a;
a.y2 = dsc->p1->y - 5;
a.y1 = a.y2 - size.y - 10;
a.x1 = dsc->p1->x + 10;
a.x2 = a.x1 + size.x + 10;
lv_draw_label_dsc_t draw_label_dsc;
lv_draw_label_dsc_init(&draw_label_dsc);
draw_label_dsc.color = lv_color_white();
a.x1 += 5;
a.x2 -= 5;
a.y1 += 5;
a.y2 -= 5;
lv_draw_label(dsc->draw_ctx, &ui_obj->draw_label_dsc, &a, buf, NULL);
}