User Tools

Site Tools


download-csv-js

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
download-csv-js [2022/05/10 12:09] – [Script] emozolyakdownload-csv-js [2022/05/12 08:35] – [Button release script] emozolyak
Line 1: Line 1:
-====== Example of graph data download with JS for dashbaord ======+====== Example of graph data download with JS for dashboard ======
  
 The standard method of exporting data from graphs to XLS, HTML, CSV files has the resolution of the selected view on the respective graph, not all data - due to performance issues.  The standard method of exporting data from graphs to XLS, HTML, CSV files has the resolution of the selected view on the respective graph, not all data - due to performance issues. 
Line 144: Line 144:
 } }
  
 +</code>
 +
 +==== Button release script ====
 +
 +Because the dashboard expects the register change be greater than 0, we have to reset this register after each use. 
 +The following script can do that:
 +<code lua>
 +BUTTON_REG_ID = 9
 +
 +function main (userId)
 +    
 +    local cur_value = R(BUTTON_REG_ID)
 +    
 +    if (not resetDemand and cur_value > 0) then 
 +        resetDemand = true                        -- postpone reset for one scan for JS to detect change
 +        return 
 +    end 
 +    
 +    if (resetDemand) then 
 +        reset(BUTTON_REG_ID)                     -- now real reset 
 +        resetDemand = false 
 +    end 
 +    
 +end
 +
 +function reset(reg) 
 +    local cur_value = R(reg)
 +    if cur_value and cur_value ~= 0 then 
 +        W(reg, 0)
 +    end 
 +end  
 </code> </code>
  
download-csv-js.txt · Last modified: 2023/10/15 18:07 by emozolyak

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki