i do a power monitor.
i call the lv_chart_set_range every second, if the max is change.
and draw 60’s minutes data with each line bar.
some times some minutes lines will disappear.
i use debug to check lv_chart_set_ext_y_array api.
the data has a value, but the lv_chart bar not draw it.
it looks to forget to draw. because if the data value is zero , it stil to draw a short line. like tick 16 and 19.
img
max=0;
for (int a = 0; a < 60; a++)
{
int drw = power_minutes[a]*1000.0*3600.0;
minutes_raw[a] = drw;
if(drw!=0)
if(drw>max)
{
max = drw;
}
}
if(max!=0)
{
lv_chart_set_range(guider_ui.screen_power_chart_power_raw, LV_CHART_AXIS_PRIMARY_Y, 0,max );
if(curPowMode!=powerMode)
{
curPowMode = powerMode;
lv_chart_set_axis_tick(guider_ui.screen_power_chart_power_raw, LV_CHART_AXIS_PRIMARY_X, 10, 5, 60, 1, true, 40);
lv_chart_set_point_count(guider_ui.screen_power_chart_power_raw, 60);
lv_chart_set_ext_y_array(guider_ui.screen_power_chart_power_raw, guider_ui.screen_power_chart_power_raw_0, minutes_raw);
}
}
lv_chart_refresh(guider_ui.screen_power_chart_power_raw);