How to display a large histogram


Im doing some signal analysis using an ADC on a Teensy 4.1 and I have code that creates a histogram that I currently print out to the serial monitor.

I would like to display the histogram on a display, but my only concern is the histogram has 1024 bins and my display width is only 480px wide, so Im sure there will be some compressing of the visual data, but can a chart handle that many data points at once?

Also, searching here I have only seen one person post about displaying a histogram but there is not direct code example, so would love a tip if anyone can assist.

My histogram is a uint16_t with 1024 positions as I mentioned. I counts values in each bin.

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

Teensy 4.1

What LVGL version are you using?



First off, an object too large to fit in its area (your entire display in this case) will automatically be made scrollable - so as for it being too large it might not be an issue if scrolling is possible on your device.

Concerning the amount of data points, there’s only really one way to figure if your chart can handle it, I don’t know myself and I don’t think anybody has really tried that and mentioned it here.

@Tinus thanks for the reply

I can scroll but it updates 10 times a second so I need to disable scrolling
I read somewhere there is an auto compression on charts with many data points, it’s built into the lv_chart.c file

I got it working, mostly

Only thing I can’t figure out is why zero values show up (green bar at the bottom)

Got rid of the zero values bar using LV_CHART_POINT_NONE when a bin value is equivalent to 0.

The implementation doesn’t make too much sense to me as you feed the define which its value is the max value of an uint32_t …

Anyways, problem solved

Got another question… I wan to add another data/chart type onto the existing chart
I would like to display my ADC raw readings in a line chart.

Can I just create a new chart and place it on top of the existing one?