Files
J1B3-Sensor-boxes/docs/brainstorm/SoftwareDocumentatie/graph_classes.md
2024-03-22 12:35:22 +01:00

1.5 KiB

Graphs

Introduction

The graphs are used to display the data from the sensors. The data is collected by the raspberry pi and then displayed on the graphs. The graphs are made using the plotly library .

Requirements

Live graphs

  • Every node has to have a live graph
  • The graphs has to be updated every 5 seconds
  • All the data from one node has to fit in one graph

Class diagrams

Graphs

classDiagram
    class graph {
        +nodeId
        makeGraph()
    }

Live graphs

classDiagram
    class liveGraph extends graph {
        +nodeId
        +cnt
        +timeArray
        +tempArray
        +humiArray
        +eco2Array
        +tvocArray
        makeGraph()
        updateGraph()
        updateData()
    }

Order of operations

Live graphs

sequenceDiagram
    participant Node
    participant Raspberry pi
    participant Website

    Node->>Raspberry pi: sensordata via websocket every 5 seconds
    Raspberry pi->>Website: Node data via websocket if new data is received from the node
    Website->>Website: updateGraph()
    Website->>Website: updateData()
  1. Every node sends its data to the raspberry pi via websocket every 5 seconds
  2. The raspberry pi sends the data to the website via websocket if new data is received from the node
  3. The website updates the data coming from the raspberry pi on its own variables and arrays
  4. The website updates the live graphs every time new data is received from the websocket