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_1.c (1491B)
1 #include "../../lv_examples.h" 2 #if LV_USE_CHART && LV_BUILD_EXAMPLES 3 4 void lv_example_chart_1(void) 5 { 6 /*Create a chart*/ 7 lv_obj_t * chart; 8 chart = lv_chart_create(lv_scr_act()); 9 lv_obj_set_size(chart, 200, 150); 10 lv_obj_center(chart); 11 lv_chart_set_type(chart, LV_CHART_TYPE_LINE); /*Show lines and points too*/ 12 13 /*Add two data series*/ 14 lv_chart_series_t * ser1 = lv_chart_add_series(chart, lv_palette_main(LV_PALETTE_RED), LV_CHART_AXIS_PRIMARY_Y); 15 lv_chart_series_t * ser2 = lv_chart_add_series(chart, lv_palette_main(LV_PALETTE_GREEN), LV_CHART_AXIS_SECONDARY_Y); 16 17 /*Set the next points on 'ser1'*/ 18 lv_chart_set_next_value(chart, ser1, 10); 19 lv_chart_set_next_value(chart, ser1, 10); 20 lv_chart_set_next_value(chart, ser1, 10); 21 lv_chart_set_next_value(chart, ser1, 10); 22 lv_chart_set_next_value(chart, ser1, 10); 23 lv_chart_set_next_value(chart, ser1, 10); 24 lv_chart_set_next_value(chart, ser1, 10); 25 lv_chart_set_next_value(chart, ser1, 30); 26 lv_chart_set_next_value(chart, ser1, 70); 27 lv_chart_set_next_value(chart, ser1, 90); 28 29 /*Directly set points on 'ser2'*/ 30 ser2->y_points[0] = 90; 31 ser2->y_points[1] = 70; 32 ser2->y_points[2] = 65; 33 ser2->y_points[3] = 65; 34 ser2->y_points[4] = 65; 35 ser2->y_points[5] = 65; 36 ser2->y_points[6] = 65; 37 ser2->y_points[7] = 65; 38 ser2->y_points[8] = 65; 39 ser2->y_points[9] = 65; 40 41 lv_chart_refresh(chart); /*Required after direct set*/ 42 } 43 44 #endif