Обработка масштабирования в графиках.
authorRoman Bazalevsky <rvb@rvb.name>
Tue, 21 Jan 2020 20:52:47 +0000 (23:52 +0300)
committerRoman Bazalevsky <rvb@rvb.name>
Tue, 21 Jan 2020 20:52:47 +0000 (23:52 +0300)
bin/weather-lcd

index 779bc496cb3e64f37d77849d07cea77b062932b2..8bf8ce56aa48c60a01bcd6aa9858e6985c6b3dde 100755 (executable)
@@ -201,7 +201,7 @@ function process_graphs()
       local minval =  99999999
       for k=width,1,-1 do
         if row then
       local minval =  99999999
       for k=width,1,-1 do
         if row then
-          val = row["val"]
+          val = row["val"] * def["scale"]
           row = cur:fetch ({}, "a")
         else
           val = nil  
           row = cur:fetch ({}, "a")
         else
           val = nil  
@@ -217,7 +217,7 @@ function process_graphs()
       local len = math.max(string.len(minvalstr),string.len(maxvalstr))
       write_command(conn,"widget_set "..pageid.." "..pageid..".max "..trim(tostring(width-string.len(maxvalstr)+1)).." 2 "..maxvalstr)
       for k = 3,height-1 do
       local len = math.max(string.len(minvalstr),string.len(maxvalstr))
       write_command(conn,"widget_set "..pageid.." "..pageid..".max "..trim(tostring(width-string.len(maxvalstr)+1)).." 2 "..maxvalstr)
       for k = 3,height-1 do
-        write_command(conn,"widget_set "..pageid.." "..pageid..".place"..trim(tostring(k)).." "..trim(tostring(width-len+1)).." "..k.." \""..string.rep("-",len).."\"")
+        write_command(conn,"widget_set "..pageid.." "..pageid..".place"..trim(tostring(k)).." "..trim(tostring(width-len+1)).." "..k.." \" "..string.rep("-",len-1).."\"")
       end
       write_command(conn,"widget_set "..pageid.." "..pageid..".min "..trim(tostring(width-string.len(minvalstr)+1)).." "..height.." "..minvalstr)
       local m = width
       end
       write_command(conn,"widget_set "..pageid.." "..pageid..".min "..trim(tostring(width-string.len(minvalstr)+1)).." "..height.." "..minvalstr)
       local m = width