How to display waveform using lv_chart in high refresh rate?

What do you want to achieve?

What have you tried so far?

The lv_chart waveform data refreshed by a 50ms timer using:
But,the actual refresh rate is more than 300ms. Some one let me use canvas, but I can’t find it in Squareline Studio.

Screenshot or video


  • SquareLine Studio version:
  • Operating system:
  • Target hardware:

This is mostly LVGL related. I just created a chart example on a PC with SDL library and I could achieve a decent refresh rate (about 20Hz with 50ms period) in a main loop with usleep() time increased from 5ms to 10…20ms by changing only the values of the associated Y-array (set with lv_chart_set_ext_y_array() function) directly within a for-loop and calling lv_chart_refresh() afterwards. Not sure how fast this solution would refresh on your MCU though.
(If you’re about to use a canvas, yes, there isn’t canvas widget (yet) in SquareLine Studio, maybe you should create a panel/container at least as a placeholder with given dimensions and position and then change it in the exported code afterwards. Pixelling the waveform to canvas might not make it faster for you if there are only a few datapoints. )

Thanks ! Yeap,relative to PC, the lower main frequency of mcu might result the low fresh rate of lv_chart. Now, I use lv_line_set_points to draw the waveform, it works well with 20Hz.

1 Like