Fixes empty timeseries seen in the charts

This commit is contained in:
MatteoBiscosi 2022-07-18 11:45:09 +02:00
parent d48e4005c1
commit 63bba504e8
2 changed files with 15 additions and 8 deletions

View file

@ -197,6 +197,7 @@ end
-- Add layout information
local layout = graph_utils.get_timeseries_layout(ts_schema)
local filtered_serie = {}
for _, serie in pairs(res.series or {}) do
@ -206,8 +207,18 @@ for _, serie in pairs(res.series or {}) do
end
end
local ts_tot_value = 0
for _, ts_value in pairs(serie.data or {}) do
ts_tot_value = ts_tot_value + tonumber(ts_value or 0)
end
if ts_tot_value > 0 then
filtered_serie[#filtered_serie + 1] = serie
end
end
res.series = filtered_serie
if extended_times then
if res.series and res.step then
for k, serie in pairs(res.series) do