Show PM2.5 at diagrams, too
This commit is contained in:
parent
2efa4a576c
commit
832e5def65
11
src/main.cpp
11
src/main.cpp
@ -392,6 +392,7 @@ String diagramJson(void) {
|
|||||||
String bufferLabels = "\"\"";
|
String bufferLabels = "\"\"";
|
||||||
String bufferDataTemp = "\"\"";
|
String bufferDataTemp = "\"\"";
|
||||||
String bufferDataPressure = "\"\"";
|
String bufferDataPressure = "\"\"";
|
||||||
|
String bufferDataPM = "\"\"";
|
||||||
String bufferDatasets;
|
String bufferDatasets;
|
||||||
String bufferData;
|
String bufferData;
|
||||||
if (mMeasureSeries == NULL) {
|
if (mMeasureSeries == NULL) {
|
||||||
@ -404,17 +405,19 @@ String diagramJson(void) {
|
|||||||
bufferLabels = "[ \"" + String((now - mMeasureSeries[0].timestamp) / 1000) + "s";
|
bufferLabels = "[ \"" + String((now - mMeasureSeries[0].timestamp) / 1000) + "s";
|
||||||
bufferDataTemp = "[ \"" + String(mMeasureSeries[0].temp);
|
bufferDataTemp = "[ \"" + String(mMeasureSeries[0].temp);
|
||||||
bufferDataPressure = "[ \"" + String(mMeasureSeries[0].pressure);
|
bufferDataPressure = "[ \"" + String(mMeasureSeries[0].pressure);
|
||||||
|
bufferDataPM = "[ \"" + String(mMeasureSeries[0].pm25);
|
||||||
}
|
}
|
||||||
for(i=1; i < mMeasureIndex; i++) {
|
for(i=1; i < mMeasureIndex; i++) {
|
||||||
bufferLabels += "\", \"" + String((now - mMeasureSeries[i].timestamp) / 1000) + "s";
|
bufferLabels += "\", \"" + String((now - mMeasureSeries[i].timestamp) / 1000) + "s";
|
||||||
bufferDataTemp += "\", \"" + String(mMeasureSeries[i].temp);
|
bufferDataTemp += "\", \"" + String(mMeasureSeries[i].temp);
|
||||||
bufferDataPressure += "\", \"" + String(mMeasureSeries[i].pressure);
|
bufferDataPressure += "\", \"" + String(mMeasureSeries[i].pressure);
|
||||||
/* float altitude = 44330.0 * (1.0 - pow(atmospheric / SEALEVELPRESSURE_HPA, 0.1903)); */
|
bufferDataPM += "\", \"" + String(mMeasureSeries[i].pm25);
|
||||||
}
|
}
|
||||||
if (mMeasureIndex > 0) {
|
if (mMeasureIndex > 0) {
|
||||||
bufferLabels += "\" ]";
|
bufferLabels += "\" ]";
|
||||||
bufferDataTemp += "\" ]";
|
bufferDataTemp += "\" ]";
|
||||||
bufferDataPressure += "\" ]";
|
bufferDataPressure += "\" ]";
|
||||||
|
bufferDataPM += "\" ]";
|
||||||
}
|
}
|
||||||
/* Generate label */
|
/* Generate label */
|
||||||
buffer = "{ \"labels\" : " + bufferLabels + ",\n";
|
buffer = "{ \"labels\" : " + bufferLabels + ",\n";
|
||||||
@ -426,8 +429,12 @@ String diagramJson(void) {
|
|||||||
/* generate second block for Pressure */
|
/* generate second block for Pressure */
|
||||||
buffer += ", ";
|
buffer += ", ";
|
||||||
buffer += "{\n \"label\" : \"Pressure\",\n \"data\" : " + bufferDataPressure + ",\n \"borderColor\" : \"rgba(0,0,255,1)\" \n}";
|
buffer += "{\n \"label\" : \"Pressure\",\n \"data\" : " + bufferDataPressure + ",\n \"borderColor\" : \"rgba(0,0,255,1)\" \n}";
|
||||||
/* TODO, next ones ... */
|
|
||||||
|
|
||||||
|
/* generate third block for PM2.5 values */
|
||||||
|
buffer += ", ";
|
||||||
|
buffer += "{\n \"label\" : \"PM 2.5\",\n \"data\" : " + bufferDataPM + ",\n \"borderColor\" : \"rgba(0,255,0,1)\" \n}";
|
||||||
|
|
||||||
|
/* TODO, next ones ... */
|
||||||
|
|
||||||
buffer += "]\n }";
|
buffer += "]\n }";
|
||||||
return buffer;
|
return buffer;
|
||||||
|
Loading…
Reference in New Issue
Block a user