How to reverse X axis ticks numeration

Hi, it is possible to reverse X axis tick numeration, need to create a scale from 24 to 0 ?

  • **SquareLine Studio version:1.3.4
  • **Operating system:Windows 11 x64
  • **Target hardware:esp32s3

You can do custom X axis labeling in C code in draw-events, LVGL documentation has an example where it sets month-names on X axis, but it’s usable for reverse numbering too with some modification:
The key part in the example is in the draw-even callback (assigned to the chart widget by lv_obj_add_event_cb(chart, draw_event_cb, LV_EVENT_DRAW_PART_BEGIN, NULL);:

Something like this as a callback should work:
static void draw_event_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 ) ) return;
if ( dsc->id == LV_CHART_AXIS_PRIMARY_X && dsc->text ) {
lv_snprintf( dsc->text, dsc->text_length, “%d”, 24-dsc->value );
} }