In order to add points to the chart series I need to access the variable “ui_chart_x_series_x” in the main code, e.g. in this way: lv_chart_set_next_value(ui_chartSignal, ui_chartSignal_series_1, signal);
But this is not possible because that var is local in ui.c.
I am using the latest version 1.2.2.
Do you see alternative options and workaround to achieve it?
The only way I see is to change the file ui.c to declare that var globally and add the respective extern declaration in ui.h.
This is not a good solution because my changes are lost every time I export new ui files.
Is there any other way to add points to the chart series without modifying ui.c?
Came across the same issue today. The chart series variable is locally defined in screen ‘c’ file. You just need to do declare it in ui.h and it’s good to go.
My feature recommendations:
Set series name in SLS. Right now it just series_1,2,3,etc.
Series data is charted as a LIFO array from right to left. It helps to initialize all series values with ‘0’ if series data is left empty. If adding series data in SLS, pad with ‘0’ remaining values until series end. (this will ensure no random values will ever be displayed on device)
Thanx @razvan After your suggestion, Its working correctly
in ui.c added
lv_chart_series_t * ui_Chart3_series_1 after lv_obj_t * ui_Chart3;
Also declare in ui.h
extern lv_chart_series_t * ui_Chart3_series_1; after extern lv_obj_t * ui_Chart3;
And call
lv_chart_set_next_value(ui_Chart3, ui_Chart3_series_1, current); in main.c