Description
I`m trying to setup X axis labels of my chart. Labels show time and date. They are displayed only partially, because they are too long. E.g. “14:45:30\n23.03.2024” are “14:45:30\n23.03.”
What MCU/Processor/Board and compiler are you using?
Visual Studio Code + PlatformIO, ESP32-S3 (ESP32-S3-DevKitC-1)
What LVGL version are you using?
8.3.6
What do you want to achieve?
Is there a way to increase the maximum length of asix labels?
What have you tried so far?
Code to reproduce
the chartXLabels is
std::vector<std::string> chartXLabels;
that is the part that sets the labels
static void Chart_draw_event_cb(lv_event_t *e)
{
lv_obj_draw_part_dsc_t *dsc = lv_event_get_draw_part_dsc(e);
// Check what part we are updating. Only proceed if we are updating one of the tick label(s)
if (!lv_obj_draw_part_check_type(dsc, &lv_chart_class, LV_CHART_DRAW_PART_TICK_LABEL))
return;
// Check this is a callback for a major tick (minor ticks have 0 here)
if (dsc->text == NULL)
return;
if (dsc->id == LV_CHART_AXIS_PRIMARY_X && dsc->value < chartXLabels.size())
{
//uint32_t lenght = chartXLabels[dsc->value].size();
lv_snprintf(dsc->text, dsc->text_length, "%s", chartXLabels[dsc->value].c_str());
}
}