Add createDiv() method to Graph class and update graph-classes.js, graphs.html, and graph-styles.css
This commit is contained in:
@@ -8,11 +8,16 @@ class Graph {
|
||||
this.tvocArray = [];
|
||||
}
|
||||
|
||||
createDiv() {
|
||||
let div = document.createElement("div");
|
||||
let graphDiv = document.createElement("div");
|
||||
div.setAttribute("class", "graphBody");
|
||||
graphDiv.setAttribute("id", this.id);
|
||||
div.appendChild(graphDiv);
|
||||
document.body.appendChild(div);
|
||||
}
|
||||
// Function to create a graph
|
||||
makeGraph(line, lineColor, name) {
|
||||
let div = document.createElement("div");
|
||||
div.setAttribute("id", this.id);
|
||||
document.graphBody.appendChild(div);
|
||||
let lineArray;
|
||||
switch (line) {
|
||||
case "temp":
|
||||
@@ -132,6 +137,7 @@ class DataProcessor {
|
||||
|
||||
makeGraph() {
|
||||
this.graph = new Graph(1);
|
||||
this.graph.createDiv();
|
||||
this.graph.makeGraph("temp", "red", "Temperature");
|
||||
this.graph.makeGraph("humi", "blue", "Humidity");
|
||||
this.graph.makeGraph("eco2", "green", "eCO2");
|
||||
|
Reference in New Issue
Block a user