acid-drop

- Hacking the planet from a LilyGo T-Deck using custom firmware
git clone git://git.acid.vegas/acid-drop.git
Log | Files | Refs | Archive | README | LICENSE

lv_example_chart_9.py (746B)

      1 import display_driver
      2 import lvgl as lv
      3 
      4 def 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 #
     19 chart = lv.chart(lv.scr_act())
     20 
     21 chart.set_update_mode(lv.chart.UPDATE_MODE.CIRCULAR)
     22 chart.set_size(200, 150)
     23 chart.center()
     24 
     25 chart.set_point_count(30)
     26 ser = chart.add_series(lv.palette_main(lv.PALETTE.RED), lv.chart.AXIS.PRIMARY_Y)
     27 #Prefill with data
     28 for i in range(0, 30):
     29     chart.set_next_value(ser, lv.rand(10, 90))
     30 
     31 lv.timer_create(add_data, 200, None)