image.png

    1. lv_chart_series_t * ser1;
    2. lv_obj_t* chart ;
    3. void demo11(){
    4. // 显示图标
    5. chart = lv_chart_create(lv_scr_act());
    6. lv_chart_set_type(chart, LV_CHART_TYPE_LINE);
    7. // 添加数据序列
    8. ser1 = lv_chart_add_series(chart, lv_palette_main(LV_PALETTE_RED), LV_CHART_AXIS_PRIMARY_Y);
    9. lv_chart_set_range(chart, LV_CHART_AXIS_PRIMARY_Y, 40, 150);
    10. for (size_t i = 0; i < 10; i++)
    11. {
    12. lv_chart_set_next_value(chart, ser1, lv_rand(50,110));
    13. }
    14. lv_chart_refresh(chart);
    15. }