Chart display 30000 data points with zooming and scrolling

Important: unclear posts may not receive useful answers.

Before posting

  • Get familiar with Markdown to format and structure your post
  • Be sure to update lvgl from the latest version from the master branch.
  • Be sure you have checked the relevant part of the documentation.
  • If applicable use the Simulator to eliminate hardware related issues.

Delete this section if you read and applied the mentioned points.


hey, I run the chart demo Display 1000 data points with zooming and scrolling in my device and it works well. Then I think how about enlage the data points. So I want to display 30000 data points by modify the demo code lv_example_chart_5. Then I found that when I scroll the chart(not the slider below), it worked well. But when I scroll the slider, the chart is not shown successfully when the slider is in the 1/3 range. Is there something attributes wrong I setted ?

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


What LVGL version are you using?


What do you want to achieve?

What have you tried so far?

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:

#define POINTNUM 30000
/*chart_point is an array contains 30000 points*/
void lv_example_chart_5(void)
    /*Create a chart*/
    chart = lv_chart_create(lv_scr_act());
    lv_obj_set_size(chart, 900, 150);
    lv_obj_align(chart, LV_ALIGN_CENTER, 0, 0);
    lv_chart_set_range(chart, LV_CHART_AXIS_PRIMARY_Y, -1000, 1000);

    /*Do not display points on the data*/
    lv_obj_set_style_size(chart, 0, LV_PART_INDICATOR);

    lv_chart_series_t * ser = lv_chart_add_series(chart, lv_palette_main(LV_PALETTE_RED), LV_CHART_AXIS_PRIMARY_Y);

    uint32_t pcnt = sizeof(chart_point) / sizeof(chart_point[0]);
    lv_chart_set_point_count(chart, pcnt);
    lv_chart_set_ext_y_array(chart, ser, (lv_coord_t *)chart_point);

    lv_obj_t * slider;
    slider = lv_slider_create(lv_scr_act());
    lv_slider_set_range(slider, LV_IMG_ZOOM_NONE, POINTNUM);
    lv_obj_add_event_cb(slider, slider_x_event_cb, LV_EVENT_VALUE_CHANGED, NULL);
    lv_obj_set_size(slider, 900, 10);
    lv_obj_align_to(slider, chart, LV_ALIGN_OUT_BOTTOM_MID, 0, 20);

Screenshot and/or video

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

should I modify #define LV_USE_LARGE_COORD 1 in lv_conf.h? Which widgets or effects are affected by this change?

It seems work well

Yes; LV_USE_LARGE_COORD is needed if you are doing anything which involves a lot of widgets/points, as 16-bit signed coordinates are not that large. Enabling that option switches to 32-bit signed coordinates which should be good enough for anything.

In general I suggest enabling it for any system where the RAM usage is not a huge concern, as the effects of not enabling it can be subtle and hard to diagnose.