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.c (1268B)

      1 #include "../../lv_examples.h"
      2 #if LV_USE_CHART && LV_DRAW_COMPLEX && LV_BUILD_EXAMPLES
      3 
      4 
      5 static void add_data(lv_timer_t * t)
      6 {
      7     lv_obj_t * chart = t->user_data;
      8     lv_chart_series_t * ser = lv_chart_get_series_next(chart, NULL);
      9 
     10     lv_chart_set_next_value(chart, ser, lv_rand(10, 90));
     11 
     12     uint16_t p = lv_chart_get_point_count(chart);
     13     uint16_t s = lv_chart_get_x_start_point(chart, ser);
     14     lv_coord_t * a = lv_chart_get_y_array(chart, ser);
     15 
     16     a[(s + 1) % p] = LV_CHART_POINT_NONE;
     17     a[(s + 2) % p] = LV_CHART_POINT_NONE;
     18     a[(s + 2) % p] = LV_CHART_POINT_NONE;
     19 
     20     lv_chart_refresh(chart);
     21 }
     22 
     23 /**
     24  * Circular line chart with gap
     25  */
     26 void lv_example_chart_9(void)
     27 {
     28     /*Create a stacked_area_chart.obj*/
     29     lv_obj_t * chart = lv_chart_create(lv_scr_act());
     30     lv_chart_set_update_mode(chart, LV_CHART_UPDATE_MODE_CIRCULAR);
     31     lv_obj_set_size(chart, 200, 150);
     32     lv_obj_center(chart);
     33 
     34     lv_chart_set_point_count(chart, 30);
     35     lv_chart_series_t * ser = lv_chart_add_series(chart, lv_palette_main(LV_PALETTE_RED), LV_CHART_AXIS_PRIMARY_Y);
     36     /*Prefill with data*/
     37     uint32_t i;
     38     for(i = 0; i < 30; i++) {
     39         lv_chart_set_next_value(chart, ser, lv_rand(10, 90));
     40     }
     41 
     42     lv_timer_create(add_data, 300, chart);
     43 
     44 }
     45 
     46 #endif