How to redraw the chart's tick


Hi, all, I want to draw a chart’s tick after the chart is created. For example, I have a button, when I click it, than the chart’s content and the chart’s tick will be redraw on the screen.

What MCU/Processor/Board and compiler are you using?


What LVGL version are you using?


What do you want to achieve?

redraw a chart when the button is clicked.

What have you tried so far?

read the example

Code to reproduce

Add a code snippet which can run in the simulator. It should contain only the relevant code that compiles without errors when separated from your main code base.

The code block(s) should be formatted like:

/*You code here*/
//this is the callback function of a button
void CTabPnlTrendGraph::SetNewTicks(lv_event_t * e, lv_mychart_axis_t axis, lv_coord_t major_cnt, lv_coord_t minor_cnt, lv_coord_t draw_size)
    lv_event_code_t code = lv_event_get_code(e);

    //lv_mychart_t * chart_my = (lv_mychart_t *) chart;
    if(code == LV_EVENT_CLICKED) {
		//this not works well.
		lv_chart_set_axis_tick(chart, axis, 10, 5, major_cnt, minor_cnt, true, 40);


Screenshot and/or video

If possible, add screenshots and/or videos about the current state.