Description
How to shift the text of the X-axis label to the right/left in the lvgl 8.3 chart widget?
What MCU/Processor/Board and compiler are you using?
PIC32MZ
What LVGL version are you using?
8.3
What do you want to achieve?
Hi!
I need to shift the text of the scale label. I do as in the example, but the code crashes. How can I do this? Thanks in advance for your answer
What have you tried so far?
Code to reproduce
static void draw_X_cb(lv_event_t * e)
{
lv_obj_draw_part_dsc_t * dsc = lv_event_get_draw_part_dsc(e);
if(lv_obj_draw_part_check_type(dsc, &lv_chart_class, LV_CHART_DRAW_PART_TICK_LABEL))
{
if(dsc->id == LV_CHART_AXIS_PRIMARY_X && dsc->text)
{
dsc->draw_area->x1 -= 10;
dsc->draw_area->x2 -= 10;
if(dsc->value != 0)
{
lv_snprintf(dsc->text, dsc->text_length, ā%dā, dsc->value*ScrMeasure.K_div_X);
}
else
{
dsc->text = NULL;
}
}
}
}
Screenshot and/or video
If possible, add screenshots and/or videos about the current state.