Select Git revision
airqmon.js 6.27 KiB
var gauge = new Gauge($('#gauge')[0]);
var websock;
var timeseries = {};
var charts = {};
var gaugeModes = {
staticZones: [
{strokeStyle: "#00E400", min: 0, max: 50}, // Green
{strokeStyle: "#FFFF00", min: 51, max: 100}, // Yellow
{strokeStyle: "#FF7E00", min: 101, max: 150}, // Orange
{strokeStyle: "#FF0000", min: 151, max: 200}, // Red
{strokeStyle: "#8F3F97", min: 201, max: 300}, // Violet
{strokeStyle: "#7E0023", min: 301, max: 500} // Brown
],
percentColors: [
[0.0, "#00E400" ],
[0.1, "#FFFF00" ],
[0.2, "#FF7E00"],
[0.3, "#FF0000"],
[0.4, "#8F3F97"],
[0.6, "#7E0023"]
]
}
var metrics = {
"iaq": {name: "IAQ", has_accuracy: true, decimals: 0},
"siaq": {name: "Static IAQ", has_accuracy: true, decimals: 0},
"eco2": {name: "CO2", unit: " ppm", has_accuracy: true, decimals: 0},
"bvoc": {name: "Breath VOC", unit: " ppm", has_accuracy: true, decimals: 3},
"pm1": {name: "PM ≤1.0µm", unit: " μg/m³"},
"pm2p5": {name: "PM ≤2.5µm", unit: " μg/m³"},
"pm10": {name: "PM ≤10µm", unit: " μg/m³"},
"nc0p3": {name: "NC ≥0.3µm", unit: "/100cm³"},
"nc1": {name: "NC ≥0.5µm", unit: "/100cm³"},
"nc2p5": {name: "NC ≥1.0µm", unit: "/100cm³"},
"nc5": {name: "NC ≥5.0µm", unit: "/100cm³"},
"nc10": {name: "NC ≥10µm", unit: "/100cm³"},
"temperature": {name: "Temperature", unit: " °C", decimals: 1},
"humidity": {name: "Humidity", unit: "%", decimals: 1},
"pressure": {name: "Pressure", unit: " hPa", decimals: 0}
}
var accuracyStatus = {
0: {name: "Stabilizing", class: "danger"},
1: {name: "Uncertain", class: "warning"},
2: {name: "Calibrating", class: "primary"},
3: {name: "Calibrated", class: "success"}
}
var gaugeOptions = {
angle: 0, // The span of the gauge arc
lineWidth: 0.45, // The line thickness
radiusScale: 1, // Relative radius
pointer: {
length: 0.5, // // Relative to gauge radius
strokeWidth: 0.100, // The thickness
color: '#000000' // Fill color
},
colorStart: '#6F6EA0', // Colors
colorStop: '#C0C0DB', // just experiment with them
strokeColor: '#EEEEEE', // to see which ones work best for you
generateGradient: true,
highDpiSupport: true, // High resolution support
staticLabels: {
font: "10px sans-serif", // Specifies font
labels: [50, 100, 150, 200, 300, 500], // Print labels at these values
color: "#000000", // Optional: Label text color
fractionDigits: 0 // Optional: Numerical precision. 0=round off.
}