1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-14 06:42:58 +08:00
lvgl/lv_objx/lv_chart.h

96 lines
2.4 KiB
C
Raw Normal View History

/**
* @file lv_chart.h
*
*/
#ifndef LV_CHARTBG_H
#define LV_CHARTBG_H
/*********************
* INCLUDES
*********************/
#include "lv_conf.h"
#if USE_LV_CHARTBG != 0
#include "../lv_obj/lv_obj.h"
#include "lv_rect.h"
#include "lv_line.h"
/*********************
* DEFINES
*********************/
2016-08-11 15:00:46 +02:00
#define LV_CHART_DL_NUM 8 /*Max data line number. Used in the style.*/
/**********************
* TYPEDEFS
**********************/
typedef enum
{
LV_CHART_LINE,
LV_CHART_COL,
LV_CHART_POINT,
}lv_chart_type_t;
/*Style of chart background*/
typedef struct
{
2016-12-15 10:31:30 +01:00
lv_rects_t bg_rects; /*Style of ancestor*/
2016-10-07 11:15:46 +02:00
/*New style element for this type */
2016-12-15 10:31:30 +01:00
lv_lines_t div_lines;
uint8_t div_line_opa; /*Percentage of obj. opacity*/
color_t color[LV_CHART_DL_NUM]; /*Line/Point/Col color */
2016-10-07 11:15:46 +02:00
uint16_t width; /*Line width or point radius*/
opa_t data_opa; /*Line/Point/Col opacity in the percentage of obj. opacity*/
2016-09-28 11:17:46 +02:00
uint8_t dark_eff; /*Dark effect on the bottom of ó points and columns*/
}lv_charts_t;
/*Built-in styles of chart background*/
typedef enum
{
LV_CHARTS_DEF,
}lv_charts_builtin_t;
/*Data of chart background*/
typedef struct
{
2016-12-15 10:31:30 +01:00
lv_rect_ext_t bg_rects; /*Ext. of ancestor*/
2016-10-07 11:15:46 +02:00
/*New data for this type */
2016-09-28 11:17:46 +02:00
cord_t ymin;
cord_t ymax;
uint8_t hdiv_num;
uint8_t vdiv_num;
ll_dsc_t dl_ll; /*Linked list for the data line pointers (stores cord_t * )*/
uint16_t pnum; /*Point number in a data line*/
uint8_t type :2; /*Line, column or point chart*/
uint8_t dl_num; /*Data line number in dl_ll*/
}lv_chart_ext_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
2016-10-07 11:15:46 +02:00
lv_obj_t * lv_chart_create(lv_obj_t * par, lv_obj_t * copy);
bool lv_chart_signal(lv_obj_t * chart, lv_signal_t sign, void * param);
lv_charts_t * lv_charts_get(lv_charts_builtin_t style, lv_charts_t * copy);
2016-10-07 11:15:46 +02:00
cord_t * lv_chart_add_dataline(lv_obj_t * chart);
2016-10-07 11:15:46 +02:00
void lv_chart_refr(lv_obj_t * chart);
2016-10-07 11:15:46 +02:00
void lv_chart_set_type(lv_obj_t * chart, lv_chart_type_t type);
void lv_chart_set_hvdiv(lv_obj_t * chart, uint8_t hdiv, uint8_t vdiv);
void lv_chart_set_range(lv_obj_t * chart, cord_t ymin, cord_t ymax);
void lv_chart_set_pnum(lv_obj_t * chart, uint16_t pnum);
void lv_chart_set_next(lv_obj_t * chart, cord_t * dl, cord_t y);
2016-10-07 11:15:46 +02:00
lv_chart_type_t lv_chart_get_type(lv_obj_t * chart);
uint16_t lv_chart_get_pnum(lv_obj_t * chart);
2016-08-11 15:00:46 +02:00
/**********************
* MACROS
**********************/
#endif
#endif