Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,

 

as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.

 

As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!

 

Regards,

Smart Home Forum by FIBARO Team


Question

Posted

Hi all. So I have a QA I am playing around with which provides a graph of my home temperatures from various sensors. It automatically adjusts depending the number of items in the array. This is done with HTML tags (below). I would like the 10,20,30 & 40 to be aligned at the top of the "cells" but everything I have tried doesn't work.

Any suggestions?

 

Thanks.

 

GUI:

Please login or register to see this image.

/monthly_2025_02/image.png.39c746bb7aeb5fe5bae329890d03fd69.png" />

 

 

function QuickApp:updatechart()
    local scaleMin = 0
    local scaleMax = 40
    local quantity = 0
    local wdth = 0
    local hgt=0
    local trhgt =0
    local tblVar=""
    local legVar=""
 
    -- 273.value for outside temp
 
   
    local arr = {{name="Outside",val=hub.getValue(273, "value")},{name="Master",val=getVar(308,"Temperature")},{name="Ensuite",val=hub.getValue(113, "value")},{name="Study",val=getVar(288,"Temperature")},{name="Guest",val=getVar(309,"Temperature")},{name="Living",val=getVar(310,"Temperature")},{name="Lounge",val=getVar(311,"Temperature")},{name="Entry Front",val=hub.getValue(119, "value")},{name="Entry Rear",val=hub.getValue(125, "value")}}
   
 
    self:debug(scaleMin .. " - " .. scaleMax.." - ")
        for _,i in ipairs(arr) do
        quantity = quantity+1
    end
   
    for _,i in ipairs(arr) do
        self:debug("element ".. i.name)
        self:debug("value ".. i.val)
        wdth = (10*quantity)+120
        trhgt = quantity*100//6
        hgt = ((quantity*100//6)*i.val)/(scaleMax-scaleMin)
        tblVar = tblVar.."<td><table><table width=10px><tr height="..trhgt-hgt.." bgcolor=black><td></td></tr><tr height="..hgt.." bgcolor=blue><td></td></tr></table></td>"
        legVar = legVar.."<tr bgcolor=black><td>"..i.name.."</td></tr>"
    end
 
    local tblhtml = "<table><table width="..wdth.."px><tr height="..tostring(trhgt).."px><td><table><table width=20px border=white><tr height="..tostring(trhgt//4).." bgcolor=black ><td>"..tostring(scaleMax).."</td></tr><tr height="..tostring(trhgt//4).." bgcolor=black><td>"..tostring(3*(scaleMax-scaleMin)//4).."</td></tr><tr height="..tostring(trhgt//4).." bgcolor=black><td>"..tostring(2*(scaleMax-scaleMin)//4).."</td></tr><tr height="..tostring(trhgt//4).." bgcolor=black><td>"..tostring(1*(scaleMax-scaleMin)//4).."</td></tr></table></td>"..tblVar.."<td><table><table width=100px>"..legVar.."</td></tr></table>"
 
    self:updateView("lblTable", "text", tblhtml)
 
end
 

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...