Commit edff02c4 authored by Eric Duminil's avatar Eric Duminil
Browse files

More compact JS code

parent 370e28c8
Pipeline #5877 passed with stage
in 2 minutes and 28 seconds
......@@ -131,11 +131,11 @@ namespace web_server {
".then(_=>Plotly.newPlot('graph',data,layout,{displaylogo:false}))"
".catch(console.error);"
"xs=[];y1=[];y2=[];y3=[];"
"m='lines+markers';"
"s={symbol:123};" // diamond-tall-open from https://plotly.com/python/marker-style/
"data=[{x:xs,y:y1,type:'scatter',name:'CO<sub>2</sub>',line:{color:'#2ca02c'},mode:m,marker:s},"
"{x:xs,y:y2,type:'scatter',name:'Temperature',yaxis:'y2',line:{color:'#ff7f0e',dash:'dot'},mode:m,marker:s},"
"{x:xs,y:y3,type:'scatter',name:'Humidity',yaxis:'y3',line:{color:'#1f77b4',dash:'dot'},mode:m,marker:s}];"
"d={x:xs,type:'scatter',mode:'lines+markers',marker:{symbol:123}};" // diamond-tall-open from https://plotly.com/python/marker-style/
"data = ["
"{...d,...{y:y1,name:'CO<sub>2</sub>',line:{color:'#2ca02c'}}},"
"{...d,...{y:y2,name:'Temperature',yaxis:'y2',line:{color:'#ff7f0e',dash:'dot'}}},"
"{...d,...{y:y3,name:'Humidity',yaxis:'y3',line:{color:'#1f77b4',dash:'dot'}}}];"
"layout={height:600,title:'%s',legend:{xanchor:'right',x:0.2,y:1.0},"
"xaxis:{domain:[0.0,0.85]},yaxis:{ticksuffix:'ppm',range:[0,2000],dtick:200},"
"yaxis2:{overlaying:'y',side:'right',ticksuffix:'°C',position:0.9,anchor:'free',range:[0,30],dtick:3},"
......@@ -202,7 +202,7 @@ namespace web_server {
//NOTE: Splitting in multiple parts in order to use less RAM. Higher than 2000 apparently crashes the ESP8266
char content[1700];
// Current size (with Lorawan, timesteps and long thing name):
// INFO - Header size : 1269 - Body1 size : 1259 - Body2 size : 1620 - Script size : 1485
// INFO - Header size : 1269 - Body1 size : 1259 - Body2 size : 1620 - Script size : 1496
snprintf_P(content, sizeof(content), header_template, sensor::co2, config::ampel_name(), wifi::local_ip);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment