lv_chart.h

API reference for lv_chart.h

Report on GitHub
See Also: Private HeaderThis header has a companion private implementation with internal data structures.lv_chart_private.h

Functions

lv_chart_set_type

Set a new type for a chart

 
void lv_chart_set_type(lv_obj_t *obj, lv_chart_type_t type)
Parameters
NameTypeDescription
objlv_obj_t *pointer to a chart object
typelv_chart_type_tnew type of the chart (from 'lv_chart_type_t' enum)

lv_chart_set_point_count

Set the number of points on a data line on a chart

 
void lv_chart_set_point_count(lv_obj_t *obj, uint32_t cnt)
Parameters
NameTypeDescription
objlv_obj_t *pointer to a chart object
cntuint32_tnew number of points on the data lines

lv_chart_set_axis_range

Set the minimal and maximal y values on an axis

 
void lv_chart_set_axis_range(lv_obj_t *obj, lv_chart_axis_t axis, int32_t min, int32_t max)
Parameters
NameTypeDescription
objlv_obj_t *pointer to a chart object
axislv_chart_axis_tLV_CHART_AXIS_PRIMARY_Y or LV_CHART_AXIS_SECONDARY_Y
minint32_tminimum value of the y axis
maxint32_tmaximum value of the y axis

lv_chart_set_axis_min_value

Set the minimal values on an axis

 
void lv_chart_set_axis_min_value(lv_obj_t *obj, lv_chart_axis_t axis, int32_t min)
Parameters
NameTypeDescription
objlv_obj_t *pointer to a chart object
axislv_chart_axis_tLV_CHART_AXIS_PRIMARY_Y or LV_CHART_AXIS_SECONDARY_Y
minint32_tminimal value of the y axis

lv_chart_set_axis_max_value

Set the maximal y values on an axis

 
void lv_chart_set_axis_max_value(lv_obj_t *obj, lv_chart_axis_t axis, int32_t max)
Parameters
NameTypeDescription
objlv_obj_t *pointer to a chart object
axislv_chart_axis_tLV_CHART_AXIS_PRIMARY_Y or LV_CHART_AXIS_SECONDARY_Y
maxint32_tmaximum value of the y axis

lv_chart_set_update_mode

Set update mode of the chart object. Affects

 
void lv_chart_set_update_mode(lv_obj_t *obj, lv_chart_update_mode_t update_mode)
Parameters
NameTypeDescription
objlv_obj_t *pointer to a chart object
update_modelv_chart_update_mode_tthe update mode

lv_chart_set_div_line_count

Set the number of horizontal and vertical division lines

 
void lv_chart_set_div_line_count(lv_obj_t *obj, uint32_t hdiv, uint32_t vdiv)
Parameters
NameTypeDescription
objlv_obj_t *pointer to a chart object
hdivuint32_tnumber of horizontal division lines
vdivuint32_tnumber of vertical division lines

lv_chart_set_hor_div_line_count

Set the number of horizontal division lines

 
void lv_chart_set_hor_div_line_count(lv_obj_t *obj, uint32_t cnt)
Parameters
NameTypeDescription
objlv_obj_t *pointer to a chart object
cntuint32_tnumber of horizontal division lines

lv_chart_set_ver_div_line_count

Set the number of vertical division lines

 
void lv_chart_set_ver_div_line_count(lv_obj_t *obj, uint32_t cnt)
Parameters
NameTypeDescription
objlv_obj_t *pointer to a chart object
cntuint32_tnumber of vertical division lines

lv_chart_set_series_color

Change the color of a series

 
void lv_chart_set_series_color(lv_obj_t *chart, lv_chart_series_t *series, lv_color_t color)
Parameters
NameTypeDescription
chartlv_obj_t *pointer to a chart object.
serieslv_chart_series_t *pointer to a series object
colorlv_color_tthe new color of the series

lv_chart_set_x_start_point

Set the index of the x-axis start point in the data array. This point will be considers the first (left) point and the other points will be drawn after it.

 
void lv_chart_set_x_start_point(lv_obj_t *obj, lv_chart_series_t *ser, uint32_t id)
Parameters
NameTypeDescription
objlv_obj_t *pointer to a chart object
serlv_chart_series_t *pointer to a data series on 'chart'
iduint32_tthe index of the x point in the data array

lv_chart_set_cursor_pos

Set the coordinate of the cursor with respect to the paddings

 
void lv_chart_set_cursor_pos(lv_obj_t *chart, lv_chart_cursor_t *cursor, lv_point_t *pos)
Parameters
NameTypeDescription
chartlv_obj_t *pointer to a chart object
cursorlv_chart_cursor_t *pointer to the cursor
poslv_point_t *the new coordinate of cursor relative to the chart

lv_chart_set_cursor_pos_x

Set the X coordinate of the cursor with respect to the paddings

 
void lv_chart_set_cursor_pos_x(lv_obj_t *chart, lv_chart_cursor_t *cursor, int32_t x)
Parameters
NameTypeDescription
chartlv_obj_t *pointer to a chart object
cursorlv_chart_cursor_t *pointer to the cursor
xint32_tthe new X coordinate of cursor relative to the chart

lv_chart_set_cursor_pos_y

Set the coordinate of the cursor with respect to the paddings

 
void lv_chart_set_cursor_pos_y(lv_obj_t *chart, lv_chart_cursor_t *cursor, int32_t y)
Parameters
NameTypeDescription
chartlv_obj_t *pointer to a chart object
cursorlv_chart_cursor_t *pointer to the cursor
yint32_tthe new Y coordinate of cursor relative to the chart

lv_chart_set_cursor_point

Stick the cursor to a point

 
void lv_chart_set_cursor_point(lv_obj_t *chart, lv_chart_cursor_t *cursor, lv_chart_series_t *ser, uint32_t point_id)
Parameters
NameTypeDescription
chartlv_obj_t *pointer to a chart object
cursorlv_chart_cursor_t *pointer to the cursor
serlv_chart_series_t *pointer to a series
point_iduint32_tthe point's index or LV_CHART_POINT_NONE to not assign to any points.

lv_chart_set_all_values

Initialize all data points of a series with a value

 
void lv_chart_set_all_values(lv_obj_t *obj, lv_chart_series_t *ser, int32_t value)
Parameters
NameTypeDescription
objlv_obj_t *pointer to chart object
serlv_chart_series_t *pointer to a data series on 'chart'
valueint32_tthe new value for all points. LV_CHART_POINT_NONE can be used to hide the points.

lv_chart_set_next_value

Set the next point's Y value according to the update mode policy.

 
void lv_chart_set_next_value(lv_obj_t *obj, lv_chart_series_t *ser, int32_t value)
Parameters
NameTypeDescription
objlv_obj_t *pointer to chart object
serlv_chart_series_t *pointer to a data series on 'chart'
valueint32_tthe new value of the next data

lv_chart_set_next_value2

Set the next point's X and Y value according to the update mode policy.

 
void lv_chart_set_next_value2(lv_obj_t *obj, lv_chart_series_t *ser, int32_t x_value, int32_t y_value)
Parameters
NameTypeDescription
objlv_obj_t *pointer to chart object
serlv_chart_series_t *pointer to a data series on 'chart'
x_valueint32_tthe new X value of the next data
y_valueint32_tthe new Y value of the next data

lv_chart_set_series_values

Same as lv_chart_set_next_value but set the values from an array

 
void lv_chart_set_series_values(lv_obj_t *obj, lv_chart_series_t *ser, const int32_t values[], size_t values_cnt)
Parameters
NameTypeDescription
objlv_obj_t *pointer to chart object
serlv_chart_series_t *pointer to a data series on 'chart'
valuesconst int32_tthe new values to set
values_cntsize_tnumber of items in values

lv_chart_set_series_values2

Same as lv_chart_set_next_value2 but set the values from an array

 
void lv_chart_set_series_values2(lv_obj_t *obj, lv_chart_series_t *ser, const int32_t x_values[], const int32_t y_values[], size_t values_cnt)
Parameters
NameTypeDescription
objlv_obj_t *pointer to chart object
serlv_chart_series_t *pointer to a data series on 'chart'
x_valuesconst int32_tthe new values to set on the X axis
y_valuesconst int32_tthe new values to set o nthe Y axis
values_cntsize_tnumber of items in x_values and y_values

lv_chart_set_series_value_by_id

Set an individual point's y value of a chart's series directly based on its index

 
void lv_chart_set_series_value_by_id(lv_obj_t *obj, lv_chart_series_t *ser, uint32_t id, int32_t value)
Parameters
NameTypeDescription
objlv_obj_t *pointer to a chart object
serlv_chart_series_t *pointer to a data series on 'chart'
iduint32_tthe index of the x point in the array
valueint32_tvalue to assign to array point

lv_chart_set_series_value_by_id2

Set an individual point's x and y value of a chart's series directly based on its index Can be used only with LV_CHART_TYPE_SCATTER.

 
void lv_chart_set_series_value_by_id2(lv_obj_t *obj, lv_chart_series_t *ser, uint32_t id, int32_t x_value, int32_t y_value)
Parameters
NameTypeDescription
objlv_obj_t *pointer to chart object
serlv_chart_series_t *pointer to a data series on 'chart'
iduint32_tthe index of the x point in the array
x_valueint32_tthe new X value of the next data
y_valueint32_tthe new Y value of the next data

lv_chart_set_series_ext_y_array

Set an external array for the y data points to use for the chart NOTE: It is the users responsibility to make sure the point_cnt matches the external array size.

 
void lv_chart_set_series_ext_y_array(lv_obj_t *obj, lv_chart_series_t *ser, int32_t array[])
Parameters
NameTypeDescription
objlv_obj_t *pointer to a chart object
serlv_chart_series_t *pointer to a data series on 'chart'
arrayint32_texternal array of points for chart

lv_chart_set_series_ext_x_array

Set an external array for the x data points to use for the chart NOTE: It is the users responsibility to make sure the point_cnt matches the external array size.

 
void lv_chart_set_series_ext_x_array(lv_obj_t *obj, lv_chart_series_t *ser, int32_t array[])
Parameters
NameTypeDescription
objlv_obj_t *pointer to a chart object
serlv_chart_series_t *pointer to a data series on 'chart'
arrayint32_texternal array of points for chart

Enums

lv_chart_type_t

Chart types

NameDescription
LV_CHART_TYPE_NONEDon't draw the series
LV_CHART_TYPE_LINEConnect the points with lines
LV_CHART_TYPE_CURVEConnect the points with curves
LV_CHART_TYPE_BARDraw bars for each series
LV_CHART_TYPE_STACKEDDraw a single stacked bar for each data point. Supports only positive values
LV_CHART_TYPE_SCATTERDraw points and lines in 2D (x,y coordinates)
Used by 1 function
  • lv_chart_set_type — param type

lv_chart_update_mode_t

Chart update mode for lv_chart_set_next

NameDescription
LV_CHART_UPDATE_MODE_SHIFTShift old data to the left and add the new one the right
LV_CHART_UPDATE_MODE_CIRCULARAdd the new data in a circular way
Used by 1 function
  • lv_chart_set_update_mode — param update_mode

lv_chart_axis_t

Enumeration of the axis'

NameValue
LV_CHART_AXIS_PRIMARY_Y0x00
LV_CHART_AXIS_SECONDARY_Y0x01
LV_CHART_AXIS_PRIMARY_X0x02
LV_CHART_AXIS_SECONDARY_X0x04
LV_CHART_AXIS_LAST
Used by 4 functions
  • lv_chart_set_axis_range — param axis
  • lv_chart_set_axis_min_value — param axis
  • lv_chart_set_axis_max_value — param axis
  • lv_chart_add_series — param axis

_lv_property_chart_id_t

NameValue
LV_PROPERTY_CHART_TYPE(LV_PROPERTY_CHART_START + ((int) 0 )) | (( 1 ) << 28 )
LV_PROPERTY_CHART_POINT_COUNT(LV_PROPERTY_CHART_START + ((int) 1 )) | (( 1 ) << 28 )
LV_PROPERTY_CHART_UPDATE_MODE(LV_PROPERTY_CHART_START + ((int) 2 )) | (( 1 ) << 28 )
LV_PROPERTY_CHART_HOR_DIV_LINE_COUNT(LV_PROPERTY_CHART_START + ((int) 3 )) | (( 1 ) << 28 )
LV_PROPERTY_CHART_VER_DIV_LINE_COUNT(LV_PROPERTY_CHART_START + ((int) 4 )) | (( 1 ) << 28 )
LV_PROPERTY_CHART_END

Macros

LV_CHART_POINT_NONE

 
#define LV_CHART_POINT_NONE (INT32_MAX)

Default value of points. Can be used to not draw a point

Variables

lv_chart_class

 
const lv_obj_class_t lv_chart_class

Dependencies

How is this guide?

Last updated on

On this page