This commit is contained in:
Max 2020-10-22 13:42:30 +01:00
parent 0985d77202
commit 0d18daeb9c

View File

@ -31,8 +31,8 @@ async function get_all_data() {
function draw_graph(ySeries, names, colors, div_name) { function draw_graph(ySeries, names, colors, div_name) {
var trace = { var trace = {
type: 'line', type: 'bar',
y: ySeries, y: ySeries.data,
x: formatted_datetimes, x: formatted_datetimes,
text: names.title, text: names.title,
marker: { color: colors.trace, line: { width: 5 } } marker: { color: colors.trace, line: { width: 5 } }
@ -58,31 +58,31 @@ async function plot_graphs() {
await get_all_data() await get_all_data()
console.log("Starting data plot..."); console.log("Starting data plot...");
draw_graph( draw_graph(
temperatures, {data: temperatures, type: 'line'},
{title: "Air Temperature",yaxis: "Temperature in ºC"}, {title: "Air Temperature",yaxis: "Temperature in ºC"},
{trace: '#00FFFF'}, {trace: '#00FFFF'},
'temp_chart' 'temp_chart'
) )
draw_graph( draw_graph(
humidities, {data: humidities, type: 'line'},
{title: "Humidity",yaxis: "Air humidity in %"}, {title: "Humidity",yaxis: "Air humidity in %"},
{trace: '#00AAFF'}, {trace: '#00AAFF'},
'humidity_chart' 'humidity_chart'
) )
draw_graph( draw_graph(
winds, {data: winds, type: 'line'},
{title: "Wind speed",yaxis: "Wind speed in m/s"}, {title: "Wind speed",yaxis: "Wind speed in m/s"},
{trace: '#AAFFAA'}, {trace: '#AAFFAA'},
'wind_chart' 'wind_chart'
) )
draw_graph( draw_graph(
precipitations, {data: precipitations, type: 'bar'},
{title: "Precipitation",yaxis: "Rainfall in mm"}, {title: "Precipitation",yaxis: "Rainfall in mm"},
{trace: '#FF3333'}, {trace: '#FF3333'},
'rain_chart' 'rain_chart'
) )
draw_graph( draw_graph(
clouds, {data: clouds, type: 'line'},
{title: "Cloudiness",yaxis: "Cloud coverage in %"}, {title: "Cloudiness",yaxis: "Cloud coverage in %"},
{trace: '#FFFFFF'}, {trace: '#FFFFFF'},
'cloud_chart' 'cloud_chart'