Chart shift mode for division lines and tick labels

Description

Is it possible that the division lines and tick labels are also be shifted with the LV_CHART_UPDATE_MODE_SHIFT update mode?

What LVGL version are you using?

v8.3.4

lv_obj_t * chart = lv_chart_create(lv_scr_act());
lv_chart_set_type(chart, LV_CHART_TYPE_LINE);
lv_chart_set_point_count(chart, 100);
lv_chart_set_range(chart, LV_CHART_AXIS_PRIMARY_Y, 0, 100);
lv_chart_set_div_line_count(chart, 5, 7);
lv_chart_series_t * serie = lv_chart_add_series(chart, lv_palette_main(LV_PALETTE_RED), LV_CHART_AXIS_PRIMARY_Y);

/* Set the update mode to shift */
lv_chart_set_update_mode(chart, LV_CHART_UPDATE_MODE_SHIFT);

best regards,
Uli

I think I have to add a callback for the LV_EVENT_DRAW_MAIN event on the chart object and then to rewrite the draw_div_lines from the chart to get this custom behaviour.

Or does somebody maybe has a better solution?

best regards,
Uli

Hi @usyber ,

Yes you are on the right track, you can take inspiration from this example in the documentation here.

Also I posted an example last year here which may also be useful as a reference. Just beware there is a typo in the code the malloc(i_pnt); statements should be malloc(i_pnt+1);!

Kind Regards,

Pete

Hi Pete,

thanks a lot I will have a look.

best regards,
Uli