This commit is contained in:
Max 2020-12-24 18:07:11 +00:00
parent 264f0d9aca
commit d4ef57f89b
2 changed files with 22 additions and 21 deletions

View File

@ -127,6 +127,12 @@ Get out of my source code
<div class="container chart_container">
<div id="cloud_chart" class="chart"></div>
</div>
<div class="container chart_container">
<div id="soil_temp__chart" class="chart"></div>
</div>
<div class="container chart_container">
<div id="soil_hmdt_chart" class="chart"></div>
</div>
<div class="container">
<div class="container-title">
The plant watering index

View File

@ -4,6 +4,8 @@ var humidities = []
var winds = []
var precipitations = []
var clouds = []
var stemps = []
var shmdts = []
var datetimes = []
var formatted_datetimes = []
var test_1 = [1, 2, 3, 4, 5, 6, 7]
@ -25,6 +27,8 @@ async function get_all_data() {
winds.push(slice.wind)
precipitations.push(slice.rain_1h)
clouds.push(slice.cloud)
stemps.push(slice.local_soil_temperature)
shmdts.push(slice.local_soil_humidity)
})
console.log("Added all data...");
}
@ -58,36 +62,27 @@ function draw_graph(ySeries, names, colors, div_name) {
async function plot_graphs() {
await get_all_data()
console.log("Starting data plot...");
draw_graph(
{data: temperatures, type: 'line'},
{title: "Air Temperature",yaxis: "Temperature in ºC"},
{trace: '#00FFFF'},
draw_graph({ data: temperatures, type: 'line' }, { title: "Air Temperature", yaxis: "Temperature in ºC" }, { trace: '#00FFFF' },
'temp_chart'
)
draw_graph(
{data: humidities, type: 'line'},
{title: "Humidity",yaxis: "Air humidity in %"},
{trace: '#00AAFF'},
draw_graph({ data: humidities, type: 'line' }, { title: "Humidity", yaxis: "Air humidity in %" }, { trace: '#00AAFF' },
'humidity_chart'
)
draw_graph(
{data: winds, type: 'line'},
{title: "Wind speed",yaxis: "Wind speed in m/s"},
{trace: '#AAFFAA'},
draw_graph({ data: winds, type: 'line' }, { title: "Wind speed", yaxis: "Wind speed in m/s" }, { trace: '#AAFFAA' },
'wind_chart'
)
draw_graph(
{data: precipitations, type: 'bar'},
{title: "Precipitation",yaxis: "Rainfall in mm"},
{trace: '#FF3333'},
draw_graph({ data: precipitations, type: 'bar' }, { title: "Precipitation", yaxis: "Rainfall in mm" }, { trace: '#FF3333' },
'rain_chart'
)
draw_graph(
{data: clouds, type: 'bar'},
{title: "Cloud cover",yaxis: "Cloud coverage in %"},
{trace: '#FFFFFF'},
draw_graph({ data: clouds, type: 'bar' }, { title: "Cloud cover", yaxis: "Cloud coverage in %" }, { trace: '#FFFFFF' },
'cloud_chart'
)
draw_graph({ data: stemps, type: 'line' }, { title: "Soil temperature", yaxis: "Temperature in ºC" }, { trace: '#FF9966' },
'soil_temp__chart'
)
draw_graph({ data: shmdts, type: 'line' }, { title: "Soil humidity", yaxis: "Humidity (0->3000)" }, { trace: '#9933FF' },
'soil_hmdt_chart'
)
}