From: Roman Bazalevsky Date: Wed, 22 Jan 2020 03:16:26 +0000 (+0300) Subject: Не создаем лишние столбцы диаграммы, чтоб не портить картинку. X-Git-Url: https://git.rvb.name/weathermon.git/commitdiff_plain/3cde6e4128c98b6b9c35f52fff560e4f20e2d4d8?ds=sidebyside Не создаем лишние столбцы диаграммы, чтоб не портить картинку. --- diff --git a/bin/weather-lcd b/bin/weather-lcd index 8bf8ce5..17436ef 100755 --- a/bin/weather-lcd +++ b/bin/weather-lcd @@ -160,9 +160,6 @@ function setup_pages(conn) for k = 3,height-1 do write_command(conn,"widget_add "..pageid.." "..pageid..".place"..trim(tostring(k)).." string") end - for k=1,width do - write_command(conn,"widget_add "..pageid.." "..pageid..".bar"..trim(tostring(k)).." vbar") - end write_command(conn,"widget_set "..pageid.." "..pageid..".title \"".. pagetitle.."\"") end end @@ -221,6 +218,9 @@ function process_graphs() end write_command(conn,"widget_set "..pageid.." "..pageid..".min "..trim(tostring(width-string.len(minvalstr)+1)).." "..height.." "..minvalstr) local m = width + for k=1,width do + write_command(conn,"widget_del "..pageid.." "..pageid..".bar"..trim(tostring(k))) + end for k = width-len,1,-1 do val = vals[m] if val then @@ -228,12 +228,10 @@ function process_graphs() else h = 0 end + write_command(conn,"widget_add "..pageid.." "..pageid..".bar"..trim(tostring(k)).." vbar") write_command(conn,"widget_set "..pageid.." "..pageid..".bar"..trim(tostring(k)).." "..k.." "..height.." "..h) m = m - 1 end - for k= m,1,-1 do - write_command(conn,"widget_set "..pageid.." "..pageid..".bar"..trim(tostring(k)).." 0 0 0") - end end end end