From e7ba9b93af5f3ca352c56cf0de6b51b6809a7f85 Mon Sep 17 00:00:00 2001 From: Karijn Wessing Date: Fri, 1 Oct 2021 09:51:49 +0200 Subject: [PATCH] feat(example) add lv_example_chart_9.py (#2604) * Create lv_example_chart_9.py lv_example_chart_9.c was exactly what i needed, thanks for that one! the only thing is, i needed it in MicroPython :-) Here it is * Update lv_example_chart_9.py removed duplicate (... = lv.CHAR_POINT.NONE) lines * Update lv_example_chart_9.py restored gap --- examples/widgets/chart/lv_example_chart_9.py | 31 ++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 examples/widgets/chart/lv_example_chart_9.py diff --git a/examples/widgets/chart/lv_example_chart_9.py b/examples/widgets/chart/lv_example_chart_9.py new file mode 100644 index 000000000..37b16b394 --- /dev/null +++ b/examples/widgets/chart/lv_example_chart_9.py @@ -0,0 +1,31 @@ +import display_driver +import lvgl as lv + +def add_data(t): + chart.set_next_value(ser, lv.rand(10, 90)) + + p = chart.get_point_count() + s = chart.get_x_start_point(ser) + a = chart.get_y_array(ser) + + a[(s + 1) % p] = lv.CHART_POINT.NONE + a[(s + 2) % p] = lv.CHART_POINT.NONE + a[(s + 3) % p] = lv.CHART_POINT.NONE + chart.refresh() + +# +# Circular line chart with gap +# +chart = lv.chart(lv.scr_act()) + +chart.set_update_mode(lv.chart.UPDATE_MODE.CIRCULAR) +chart.set_size(200, 150) +chart.center() + +chart.set_point_count(30) +ser = chart.add_series(lv.palette_main(lv.PALETTE.RED), lv.chart.AXIS.PRIMARY_Y) +#Prefill with data +for i in range(0, 30): + chart.set_next_value(ser, lv.rand(10, 90)) + +lv.timer_create(add_data, 200, None)