fix(chart): set the series id correctly (#5482)

This commit is contained in:
Gabor Kiss-Vamosi
2024-01-29 13:27:21 +01:00
committed by GitHub
parent b45ef5ccf9
commit 4f9c16f177
5 changed files with 106 additions and 23 deletions

View File

@@ -1500,24 +1500,10 @@ static void chart_event_cb(lv_event_t * e)
lv_text_get_size(&text_size, buf, font_normal, 0, 0, LV_COORD_MAX, LV_TEXT_FLAG_NONE);
lv_area_t txt_area;
if(lv_chart_get_type(obj) == LV_CHART_TYPE_BAR) {
txt_area.y2 = draw_task->area.y1 - LV_DPX(15);
txt_area.y1 = txt_area.y2 - text_size.y;
if(ser == lv_chart_get_series_next(obj, NULL)) {
txt_area.x1 = draw_task->area.x1 + lv_area_get_width(&draw_task->area) / 2;
txt_area.x2 = txt_area.x1 + text_size.x;
}
else {
txt_area.x2 = draw_task->area.x1 + lv_area_get_width(&draw_task->area) / 2;
txt_area.x1 = txt_area.x2 - text_size.x;
}
}
else {
txt_area.x1 = draw_task->area.x1 + lv_area_get_width(&draw_task->area) / 2 - text_size.x / 2;
txt_area.x2 = txt_area.x1 + text_size.x;
txt_area.y2 = draw_task->area.y1 - LV_DPX(15);
txt_area.y1 = txt_area.y2 - text_size.y;
}
txt_area.y2 = draw_task->area.y1 - LV_DPX(15);
txt_area.y1 = txt_area.y2 - text_size.y;
txt_area.x1 = draw_task->area.x1 + (lv_area_get_width(&draw_task->area) - text_size.x) / 2;
txt_area.x2 = txt_area.x1 + text_size.x;
lv_area_t bg_area;
bg_area.x1 = txt_area.x1 - LV_DPX(8);