ESP-DASH icon indicating copy to clipboard operation
ESP-DASH copied to clipboard

[BUG]chart example

Open bpesun opened this issue 2 years ago • 2 comments

Describe the bug I tried to put 101 data in the XAxis and YAxis array . But char can only display about 24 bars. But if i put 50 data in XAxis and YAxis array, it can display all the data correctly.

To Reproduce Steps to reproduce the behavior:

  1. change the length of the XAxis as: String XAxis[101]
  2. change the length of the YAxis as : int YAxis[101]
  3. in the setup function, change the length of the XAxis as: power.updateX(XAxis, 101)
  4. in the loop function, change the length of the YAxis as :
    for(int i=0; i < 101; i++){ YAxis[i] = (int)random(0, 200); power.updateY(YAxis, 101);

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem. error

Additional context Great work, thanks.

bpesun avatar Aug 19 '22 00:08 bpesun

Hi @bpesun,

This will be fixed with the V4 release which is just around the corner.

Causes:

  1. Currently, the charts work by copying all the array data into the heap which creates a less than ideal environment for large data.

  2. String class in itself consumes a lot of memory and creating an array of strings with 101 elements will also limit your memory by a lot.

Solution:

For V3, the best thing is to consolidate a large dataset into smaller entries that can easily be displayed by the microcontroller without going out of memory.

ayushsharma82 avatar Aug 29 '22 08:08 ayushsharma82

Thanks a lot.

bpesun avatar Aug 30 '22 04:08 bpesun