How to change the spacing between bars in a chart?


I created a columns chart with a single series and it works, except that the spacing between the bars is way too wide. Is there a way to increase the bars’ width and reduce the spacing width?

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


What LVGL version are you using?


What do you want to achieve?

Wider bars and less space between them.

What have you tried so far?

Searched the documentation, API, and the forums here.

Code to reproduce

It’s a general questions about the capabilities of the LVGL COLUMNS chart, not specific for any code.

Screenshot and/or video

Screenshot 2021-01-09 141121

Note that there is 2 type of spacing here:

  1. the space you see here, (between x == 0 and x == 1). At this moment this is hardcoded to “1 column width space”
  2. the space between columns on the same x coordinate (if you have multiple series)

Change this line to:

lv_coord_t col_w = w / ((_lv_ll_get_len(&ext->series_ll) + 0) * ext->point_cnt); 

This way only the 2) type of spacing will be visible and it can be adjusted with pad_inner on the series part.

Thanks kisvegabor. The chart in my picture has only a single series. Any chance extending the LVGL API to allow control of the inter bar spacing?

I plan to let platformio to manage the LVGL library so prefer not to fork it.