Lines Matching refs:chart
79 lv_chart_t * chart = (lv_chart_t *)obj; in lv_chart_set_type() local
80 if(chart->type == type) return; in lv_chart_set_type()
82 if(chart->type == LV_CHART_TYPE_SCATTER) { in lv_chart_set_type()
84 _LV_LL_READ_BACK(&chart->series_ll, ser) { in lv_chart_set_type()
92 _LV_LL_READ_BACK(&chart->series_ll, ser) { in lv_chart_set_type()
93 ser->x_points = lv_mem_alloc(sizeof(lv_point_t) * chart->point_cnt); in lv_chart_set_type()
99 chart->type = type; in lv_chart_set_type()
108 lv_chart_t * chart = (lv_chart_t *)obj; in lv_chart_set_point_count() local
109 if(chart->point_cnt == cnt) return; in lv_chart_set_point_count()
115 _LV_LL_READ_BACK(&chart->series_ll, ser) { in lv_chart_set_point_count()
116 if(chart->type == LV_CHART_TYPE_SCATTER) { in lv_chart_set_point_count()
123 chart->point_cnt = cnt; in lv_chart_set_point_count()
134 lv_chart_t * chart = (lv_chart_t *)obj; in lv_chart_set_range() local
137 chart->ymin[0] = min; in lv_chart_set_range()
138 chart->ymax[0] = max; in lv_chart_set_range()
141 chart->ymin[1] = min; in lv_chart_set_range()
142 chart->ymax[1] = max; in lv_chart_set_range()
145 chart->xmin[0] = min; in lv_chart_set_range()
146 chart->xmax[0] = max; in lv_chart_set_range()
149 chart->xmin[1] = min; in lv_chart_set_range()
150 chart->xmax[1] = max; in lv_chart_set_range()
164 lv_chart_t * chart = (lv_chart_t *)obj; in lv_chart_set_update_mode() local
165 if(chart->update_mode == update_mode) return; in lv_chart_set_update_mode()
167 chart->update_mode = update_mode; in lv_chart_set_update_mode()
175 lv_chart_t * chart = (lv_chart_t *)obj; in lv_chart_set_div_line_count() local
176 if(chart->hdiv_cnt == hdiv && chart->vdiv_cnt == vdiv) return; in lv_chart_set_div_line_count()
178 chart->hdiv_cnt = hdiv; in lv_chart_set_div_line_count()
179 chart->vdiv_cnt = vdiv; in lv_chart_set_div_line_count()
188 lv_chart_t * chart = (lv_chart_t *)obj; in lv_chart_set_zoom_x() local
189 if(chart->zoom_x == zoom_x) return; in lv_chart_set_zoom_x()
191 chart->zoom_x = zoom_x; in lv_chart_set_zoom_x()
202 lv_chart_t * chart = (lv_chart_t *)obj; in lv_chart_set_zoom_y() local
203 if(chart->zoom_y == zoom_y) return; in lv_chart_set_zoom_y()
205 chart->zoom_y = zoom_y; in lv_chart_set_zoom_y()
216 lv_chart_t * chart = (lv_chart_t *)obj; in lv_chart_get_zoom_x() local
217 return chart->zoom_x; in lv_chart_get_zoom_x()
224 lv_chart_t * chart = (lv_chart_t *)obj; in lv_chart_get_zoom_y() local
225 return chart->zoom_y; in lv_chart_get_zoom_y()
249 lv_chart_t * chart = (lv_chart_t *)obj; in lv_chart_get_type() local
250 return chart->type; in lv_chart_get_type()
257 lv_chart_t * chart = (lv_chart_t *)obj; in lv_chart_get_point_count() local
258 return chart->point_cnt; in lv_chart_get_point_count()
264 lv_chart_t * chart = (lv_chart_t *)obj; in lv_chart_get_x_start_point() local
266 return chart->update_mode == LV_CHART_UPDATE_MODE_SHIFT ? ser->start_point : 0; in lv_chart_get_x_start_point()
275 lv_chart_t * chart = (lv_chart_t *)obj; in lv_chart_get_point_pos_by_id() local
276 if(id >= chart->point_cnt) { in lv_chart_get_point_pos_by_id()
283 lv_coord_t w = ((int32_t)lv_obj_get_content_width(obj) * chart->zoom_x) >> 8; in lv_chart_get_point_pos_by_id()
284 lv_coord_t h = ((int32_t)lv_obj_get_content_height(obj) * chart->zoom_y) >> 8; in lv_chart_get_point_pos_by_id()
286 if(chart->type == LV_CHART_TYPE_LINE) { in lv_chart_get_point_pos_by_id()
287 p_out->x = (w * id) / (chart->point_cnt - 1); in lv_chart_get_point_pos_by_id()
289 else if(chart->type == LV_CHART_TYPE_SCATTER) { in lv_chart_get_point_pos_by_id()
290 …p_out->x = lv_map(ser->x_points[id], chart->xmin[ser->x_axis_sec], chart->xmax[ser->x_axis_sec], 0… in lv_chart_get_point_pos_by_id()
292 else if(chart->type == LV_CHART_TYPE_BAR) { in lv_chart_get_point_pos_by_id()
293 uint32_t ser_cnt = _lv_ll_get_len(&chart->series_ll); in lv_chart_get_point_pos_by_id()
295 … int32_t ser_gap = ((int32_t)lv_obj_get_style_pad_column(obj, LV_PART_ITEMS) * chart->zoom_x) >> 8; in lv_chart_get_point_pos_by_id()
298 …int32_t block_gap = ((int32_t)lv_obj_get_style_pad_column(obj, LV_PART_MAIN) * chart->zoom_x) >> 8; in lv_chart_get_point_pos_by_id()
300 lv_coord_t block_w = (w - ((chart->point_cnt - 1) * block_gap)) / chart->point_cnt; in lv_chart_get_point_pos_by_id()
304 _LV_LL_READ_BACK(&chart->series_ll, ser_i) { in lv_chart_get_point_pos_by_id()
309 p_out->x = (int32_t)((int32_t)(w + block_gap) * id) / chart->point_cnt; in lv_chart_get_point_pos_by_id()
321 id = ((int32_t)start_point + id) % chart->point_cnt; in lv_chart_get_point_pos_by_id()
323 temp_y = (int32_t)((int32_t)ser->y_points[id] - chart->ymin[ser->y_axis_sec]) * h; in lv_chart_get_point_pos_by_id()
324 temp_y = temp_y / (chart->ymax[ser->y_axis_sec] - chart->ymin[ser->y_axis_sec]); in lv_chart_get_point_pos_by_id()
347 lv_chart_t * chart = (lv_chart_t *)obj; in lv_chart_add_series() local
348 lv_chart_series_t * ser = _lv_ll_ins_head(&chart->series_ll); in lv_chart_add_series()
355 ser->y_points = lv_mem_alloc(sizeof(lv_coord_t) * chart->point_cnt); in lv_chart_add_series()
358 if(chart->type == LV_CHART_TYPE_SCATTER) { in lv_chart_add_series()
359 ser->x_points = lv_mem_alloc(sizeof(lv_coord_t) * chart->point_cnt); in lv_chart_add_series()
363 _lv_ll_remove(&chart->series_ll, ser); in lv_chart_add_series()
376 for(i = 0; i < chart->point_cnt; i++) { in lv_chart_add_series()
389 lv_chart_t * chart = (lv_chart_t *)obj; in lv_chart_remove_series() local
393 _lv_ll_remove(&chart->series_ll, series); in lv_chart_remove_series()
399 void lv_chart_hide_series(lv_obj_t * chart, lv_chart_series_t * series, bool hide) in lv_chart_hide_series() argument
401 LV_ASSERT_OBJ(chart, MY_CLASS); in lv_chart_hide_series()
405 lv_chart_refresh(chart); in lv_chart_hide_series()
408 void lv_chart_set_series_color(lv_obj_t * chart, lv_chart_series_t * series, lv_color_t color) in lv_chart_set_series_color() argument
410 LV_ASSERT_OBJ(chart, MY_CLASS); in lv_chart_set_series_color()
414 lv_chart_refresh(chart); in lv_chart_set_series_color()
422 lv_chart_t * chart = (lv_chart_t *)obj; in lv_chart_set_x_start_point() local
423 if(id >= chart->point_cnt) return; in lv_chart_set_x_start_point()
431 lv_chart_t * chart = (lv_chart_t *)obj; in lv_chart_get_series_next() local
432 if(ser == NULL) return _lv_ll_get_head(&chart->series_ll); in lv_chart_get_series_next()
433 else return _lv_ll_get_next(&chart->series_ll, ser); in lv_chart_get_series_next()
451 lv_chart_t * chart = (lv_chart_t *)obj; in lv_chart_add_cursor() local
452 lv_chart_cursor_t * cursor = _lv_ll_ins_head(&chart->cursor_ll); in lv_chart_add_cursor()
473 void lv_chart_set_cursor_pos(lv_obj_t * chart, lv_chart_cursor_t * cursor, lv_point_t * pos) in lv_chart_set_cursor_pos() argument
476 LV_UNUSED(chart); in lv_chart_set_cursor_pos()
481 lv_chart_refresh(chart); in lv_chart_set_cursor_pos()
491 void lv_chart_set_cursor_point(lv_obj_t * chart, lv_chart_cursor_t * cursor, lv_chart_series_t * se… in lv_chart_set_cursor_point() argument
494 LV_UNUSED(chart); in lv_chart_set_cursor_point()
498 if(ser == NULL) ser = lv_chart_get_series_next(chart, NULL); in lv_chart_set_cursor_point()
500 lv_chart_refresh(chart); in lv_chart_set_cursor_point()
509 lv_point_t lv_chart_get_cursor_point(lv_obj_t * chart, lv_chart_cursor_t * cursor) in lv_chart_get_cursor_point() argument
512 LV_UNUSED(chart); in lv_chart_get_cursor_point()
526 lv_chart_t * chart = (lv_chart_t *)obj; in lv_chart_set_all_value() local
528 for(i = 0; i < chart->point_cnt; i++) { in lv_chart_set_all_value()
540 lv_chart_t * chart = (lv_chart_t *)obj; in lv_chart_set_next_value() local
543 ser->start_point = (ser->start_point + 1) % chart->point_cnt; in lv_chart_set_next_value()
552 lv_chart_t * chart = (lv_chart_t *)obj; in lv_chart_set_next_value2() local
554 if(chart->type != LV_CHART_TYPE_SCATTER) { in lv_chart_set_next_value2()
561 ser->start_point = (ser->start_point + 1) % chart->point_cnt; in lv_chart_set_next_value2()
569 lv_chart_t * chart = (lv_chart_t *)obj; in lv_chart_set_value_by_id() local
571 if(id >= chart->point_cnt) return; in lv_chart_set_value_by_id()
581 lv_chart_t * chart = (lv_chart_t *)obj; in lv_chart_set_value_by_id2() local
583 if(chart->type != LV_CHART_TYPE_SCATTER) { in lv_chart_set_value_by_id2()
588 if(id >= chart->point_cnt) return; in lv_chart_set_value_by_id2()
634 lv_chart_t * chart = (lv_chart_t *)obj; in lv_chart_get_pressed_point() local
635 return chart->pressed_point_id; in lv_chart_get_pressed_point()
647 lv_chart_t * chart = (lv_chart_t *)obj; in lv_chart_constructor() local
649 _lv_ll_init(&chart->series_ll, sizeof(lv_chart_series_t)); in lv_chart_constructor()
650 _lv_ll_init(&chart->cursor_ll, sizeof(lv_chart_cursor_t)); in lv_chart_constructor()
652 chart->ymin[0] = 0; in lv_chart_constructor()
653 chart->xmin[0] = 0; in lv_chart_constructor()
654 chart->ymin[1] = 0; in lv_chart_constructor()
655 chart->xmin[1] = 0; in lv_chart_constructor()
656 chart->ymax[0] = 100; in lv_chart_constructor()
657 chart->xmax[0] = 100; in lv_chart_constructor()
658 chart->ymax[1] = 100; in lv_chart_constructor()
659 chart->xmax[1] = 100; in lv_chart_constructor()
661 chart->hdiv_cnt = LV_CHART_HDIV_DEF; in lv_chart_constructor()
662 chart->vdiv_cnt = LV_CHART_VDIV_DEF; in lv_chart_constructor()
663 chart->point_cnt = LV_CHART_POINT_CNT_DEF; in lv_chart_constructor()
664 chart->pressed_point_id = LV_CHART_POINT_NONE; in lv_chart_constructor()
665 chart->type = LV_CHART_TYPE_LINE; in lv_chart_constructor()
666 chart->update_mode = LV_CHART_UPDATE_MODE_SHIFT; in lv_chart_constructor()
667 chart->zoom_x = LV_IMG_ZOOM_NONE; in lv_chart_constructor()
668 chart->zoom_y = LV_IMG_ZOOM_NONE; in lv_chart_constructor()
678 lv_chart_t * chart = (lv_chart_t *)obj; in lv_chart_destructor() local
680 while(chart->series_ll.head) { in lv_chart_destructor()
681 ser = _lv_ll_get_head(&chart->series_ll); in lv_chart_destructor()
685 _lv_ll_remove(&chart->series_ll, ser); in lv_chart_destructor()
688 _lv_ll_clear(&chart->series_ll); in lv_chart_destructor()
691 while(chart->cursor_ll.head) { in lv_chart_destructor()
692 cur = _lv_ll_get_head(&chart->cursor_ll); in lv_chart_destructor()
693 _lv_ll_remove(&chart->cursor_ll, cur); in lv_chart_destructor()
696 _lv_ll_clear(&chart->cursor_ll); in lv_chart_destructor()
714 lv_chart_t * chart = (lv_chart_t *)obj; in lv_chart_event() local
722 if(id != (uint32_t)chart->pressed_point_id) { in lv_chart_event()
724 invalidate_point(obj, chart->pressed_point_id); in lv_chart_event()
725 chart->pressed_point_id = id; in lv_chart_event()
730 invalidate_point(obj, chart->pressed_point_id); in lv_chart_event()
731 chart->pressed_point_id = LV_CHART_POINT_NONE; in lv_chart_event()
737 …lv_event_set_ext_draw_size(e, LV_MAX4(chart->tick[0].draw_size, chart->tick[1].draw_size, chart->t… in lv_chart_event()
738 chart->tick[3].draw_size)); in lv_chart_event()
742 p->x = ((int32_t)lv_obj_get_content_width(obj) * chart->zoom_x) >> 8; in lv_chart_event()
743 p->y = ((int32_t)lv_obj_get_content_height(obj) * chart->zoom_y) >> 8; in lv_chart_event()
750 if(_lv_ll_is_empty(&chart->series_ll) == false) { in lv_chart_event()
751 if(chart->type == LV_CHART_TYPE_LINE) draw_series_line(obj, draw_ctx); in lv_chart_event()
752 else if(chart->type == LV_CHART_TYPE_BAR) draw_series_bar(obj, draw_ctx); in lv_chart_event()
753 else if(chart->type == LV_CHART_TYPE_SCATTER) draw_series_scatter(obj, draw_ctx); in lv_chart_event()
762 lv_chart_t * chart = (lv_chart_t *)obj; in draw_div_lines() local
779 lv_coord_t w = ((int32_t)lv_obj_get_content_width(obj) * chart->zoom_x) >> 8; in draw_div_lines()
780 lv_coord_t h = ((int32_t)lv_obj_get_content_height(obj) * chart->zoom_y) >> 8; in draw_div_lines()
803 if(chart->hdiv_cnt != 0) { in draw_div_lines()
809 i_end = chart->hdiv_cnt; in draw_div_lines()
816 p1.y = (int32_t)((int32_t)h * i) / (chart->hdiv_cnt - 1); in draw_div_lines()
832 if(chart->vdiv_cnt != 0) { in draw_div_lines()
837 i_end = chart->vdiv_cnt; in draw_div_lines()
844 p1.x = (int32_t)((int32_t)w * i) / (chart->vdiv_cnt - 1); in draw_div_lines()
876 lv_chart_t * chart = (lv_chart_t *)obj; in draw_series_line() local
877 if(chart->point_cnt < 2) return; in draw_series_line()
885 lv_coord_t w = ((int32_t)lv_obj_get_content_width(obj) * chart->zoom_x) >> 8; in draw_series_line()
886 lv_coord_t h = ((int32_t)lv_obj_get_content_height(obj) * chart->zoom_y) >> 8; in draw_series_line()
911 bool crowded_mode = chart->point_cnt >= w ? true : false; in draw_series_line()
914 _LV_LL_READ_BACK(&chart->series_ll, ser) { in draw_series_line()
926 … int32_t y_tmp = (int32_t)((int32_t)ser->y_points[p_prev] - chart->ymin[ser->y_axis_sec]) * h; in draw_series_line()
927 y_tmp = y_tmp / (chart->ymax[ser->y_axis_sec] - chart->ymin[ser->y_axis_sec]); in draw_series_line()
942 for(i = 0; i < chart->point_cnt; i++) { in draw_series_line()
947 p2.x = ((w * i) / (chart->point_cnt - 1)) + x_ofs; in draw_series_line()
949 p_act = (start_point + i) % chart->point_cnt; in draw_series_line()
951 y_tmp = (int32_t)((int32_t)ser->y_points[p_act] - chart->ymin[ser->y_axis_sec]) * h; in draw_series_line()
952 y_tmp = y_tmp / (chart->ymax[ser->y_axis_sec] - chart->ymin[ser->y_axis_sec]); in draw_series_line()
1012 if(!crowded_mode && i == chart->point_cnt) { in draw_series_line()
1046 lv_chart_t * chart = (lv_chart_t *)obj; in draw_series_scatter() local
1054 lv_coord_t w = ((int32_t)lv_obj_get_content_width(obj) * chart->zoom_x) >> 8; in draw_series_scatter()
1055 lv_coord_t h = ((int32_t)lv_obj_get_content_height(obj) * chart->zoom_y) >> 8; in draw_series_scatter()
1076 _LV_LL_READ_BACK(&chart->series_ll, ser) { in draw_series_scatter()
1089 …p2.x = lv_map(ser->x_points[p_act], chart->xmin[ser->x_axis_sec], chart->xmax[ser->x_axis_sec], 0,… in draw_series_scatter()
1092 …p2.y = lv_map(ser->y_points[p_act], chart->ymin[ser->y_axis_sec], chart->ymax[ser->y_axis_sec], 0,… in draw_series_scatter()
1110 for(i = 0; i < chart->point_cnt; i++) { in draw_series_scatter()
1114 p_act = (start_point + i) % chart->point_cnt; in draw_series_scatter()
1116 …p2.y = lv_map(ser->y_points[p_act], chart->ymin[ser->y_axis_sec], chart->ymax[ser->y_axis_sec], 0,… in draw_series_scatter()
1120 …p2.x = lv_map(ser->x_points[p_act], chart->xmin[ser->x_axis_sec], chart->xmax[ser->x_axis_sec], 0,… in draw_series_scatter()
1157 if(i == chart->point_cnt) { in draw_series_scatter()
1188 lv_chart_t * chart = (lv_chart_t *)obj; in draw_series_bar() local
1194 lv_coord_t w = ((int32_t)lv_obj_get_content_width(obj) * chart->zoom_x) >> 8; in draw_series_bar()
1195 lv_coord_t h = ((int32_t)lv_obj_get_content_height(obj) * chart->zoom_y) >> 8; in draw_series_bar()
1198 uint32_t ser_cnt = _lv_ll_get_len(&chart->series_ll); in draw_series_bar()
1200 … LV_PART_MAIN) * chart->zoom_x) >> 8; /*Gap between the column on ~adjacent X*/ in draw_series_bar()
1201 lv_coord_t block_w = (w - ((chart->point_cnt - 1) * block_gap)) / chart->point_cnt; in draw_series_bar()
1203 … LV_PART_ITEMS) * chart->zoom_x) >> 8; /*Gap between the columns on the ~same X*/ in draw_series_bar()
1227 for(i = 0; i < chart->point_cnt; i++) { in draw_series_bar()
1228 …lv_coord_t x_act = (int32_t)((int32_t)(w - block_w) * i) / (chart->point_cnt - 1) + obj->coords.x1… in draw_series_bar()
1233 _LV_LL_READ_BACK(&chart->series_ll, ser) { in draw_series_bar()
1247 lv_coord_t p_act = (start_point + i) % chart->point_cnt; in draw_series_bar()
1248 … y_tmp = (int32_t)((int32_t)ser->y_points[p_act] - chart->ymin[ser->y_axis_sec]) * h; in draw_series_bar()
1249 … y_tmp = y_tmp / (chart->ymax[ser->y_axis_sec] - chart->ymin[ser->y_axis_sec]); in draw_series_bar()
1270 lv_chart_t * chart = (lv_chart_t *)obj; in draw_cursors() local
1271 if(_lv_ll_is_empty(&chart->cursor_ll)) return; in draw_cursors()
1307 _LV_LL_READ_BACK(&chart->cursor_ll, cursor) { in draw_cursors()
1385 lv_chart_t * chart = (lv_chart_t *)obj; in draw_y_ticks() local
1403 lv_coord_t h = ((int32_t)lv_obj_get_content_height(obj) * chart->zoom_y) >> 8; in draw_y_ticks()
1463 …_t tick_value = lv_map(total_tick_num - i, 0, total_tick_num, chart->ymin[sec_axis], chart->ymax[s… in draw_y_ticks()
1517 lv_chart_t * chart = (lv_chart_t *)obj; in draw_x_ticks() local
1530 lv_coord_t w = ((int32_t)lv_obj_get_content_width(obj) * chart->zoom_x) >> 8; in draw_x_ticks()
1571 if(chart->type == LV_CHART_TYPE_BAR) { in draw_x_ticks()
1573 … LV_PART_MAIN) * chart->zoom_x) >> 8; /*Gap between the columns on ~adjacent X*/ in draw_x_ticks()
1574 lv_coord_t block_w = (w + block_gap) / (chart->point_cnt); in draw_x_ticks()
1596 if(chart->type == LV_CHART_TYPE_SCATTER) { in draw_x_ticks()
1597 tick_value = lv_map(i, 0, total_tick_num, chart->xmin[sec_axis], chart->xmax[sec_axis]); in draw_x_ticks()
1668 lv_chart_t * chart = (lv_chart_t *)obj; in get_index_from_x() local
1669 lv_coord_t w = ((int32_t)lv_obj_get_content_width(obj) * chart->zoom_x) >> 8; in get_index_from_x()
1674 if(x > w) return chart->point_cnt - 1; in get_index_from_x()
1675 if(chart->type == LV_CHART_TYPE_LINE) return (x * (chart->point_cnt - 1) + w / 2) / w; in get_index_from_x()
1676 if(chart->type == LV_CHART_TYPE_BAR) return (x * chart->point_cnt) / w; in get_index_from_x()
1683 lv_chart_t * chart = (lv_chart_t *)obj; in invalidate_point() local
1684 if(i >= chart->point_cnt) return; in invalidate_point()
1686 lv_coord_t w = ((int32_t)lv_obj_get_content_width(obj) * chart->zoom_x) >> 8; in invalidate_point()
1690 if(chart->update_mode == LV_CHART_UPDATE_MODE_SHIFT) { in invalidate_point()
1695 if(chart->type == LV_CHART_TYPE_LINE) { in invalidate_point()
1707 if(i < chart->point_cnt - 1) { in invalidate_point()
1708 coords.x1 = ((w * i) / (chart->point_cnt - 1)) + x_ofs - line_width - point_w; in invalidate_point()
1709 coords.x2 = ((w * (i + 1)) / (chart->point_cnt - 1)) + x_ofs + line_width + point_w; in invalidate_point()
1714 coords.x1 = ((w * (i - 1)) / (chart->point_cnt - 1)) + x_ofs - line_width - point_w; in invalidate_point()
1715 coords.x2 = ((w * i) / (chart->point_cnt - 1)) + x_ofs + line_width + point_w; in invalidate_point()
1719 else if(chart->type == LV_CHART_TYPE_BAR) { in invalidate_point()
1722 … LV_PART_MAIN) * chart->zoom_x) >> 8; /*Gap between the column on ~adjacent X*/ in invalidate_point()
1724 lv_coord_t block_w = (w + block_gap) / chart->point_cnt; in invalidate_point()
1747 lv_chart_t * chart = (lv_chart_t *) obj; in new_points_alloc() local
1748 uint32_t point_cnt_old = chart->point_cnt; in new_points_alloc()
1791 lv_chart_t * chart = (lv_chart_t *) obj; in get_tick_gsc() local
1794 return &chart->tick[0]; in get_tick_gsc()
1796 return &chart->tick[1]; in get_tick_gsc()
1798 return &chart->tick[2]; in get_tick_gsc()
1800 return &chart->tick[3]; in get_tick_gsc()