1import display_driver
2import lvgl as lv
3
4def add_data(t):
5    chart.set_next_value(ser, lv.rand(10, 90))
6
7    p = chart.get_point_count()
8    s = chart.get_x_start_point(ser)
9    a = chart.get_y_array(ser)
10
11    a[(s + 1) % p] = lv.CHART_POINT.NONE
12    a[(s + 2) % p] = lv.CHART_POINT.NONE
13    a[(s + 3) % p] = lv.CHART_POINT.NONE
14    chart.refresh()
15
16#
17# Circular line chart with gap
18#
19chart = lv.chart(lv.scr_act())
20
21chart.set_update_mode(lv.chart.UPDATE_MODE.CIRCULAR)
22chart.set_size(200, 150)
23chart.center()
24
25chart.set_point_count(30)
26ser = chart.add_series(lv.palette_main(lv.PALETTE.RED), lv.chart.AXIS.PRIMARY_Y)
27#Prefill with data
28for i in range(0, 30):
29    chart.set_next_value(ser, lv.rand(10, 90))
30
31lv.timer_create(add_data, 200, None)
32