|
|
@@ -53,17 +53,17 @@ socket.onmessage = function(m) { |
|
|
|
// received overview data |
|
|
|
var data = JSON.parse(msg[1]); |
|
|
|
console.log(solarchart); |
|
|
|
solarchart.navigator.series[consumIdx].setData(data.consumption, false); |
|
|
|
solarchart.navigator.series[gridIdx].setData(data.grid, false); |
|
|
|
solarchart.navigator.series[prodIdx].setData(data.production, false); |
|
|
|
solarchart.get('consumptionNav').setData(data.consumption, false); |
|
|
|
solarchart.get('gridNav').setData(data.grid, false); |
|
|
|
solarchart.get('productionNav').setData(data.production, false); |
|
|
|
solarchart.redraw(); |
|
|
|
} else if (msg[0] == 'windata') { |
|
|
|
var data = JSON.parse(msg[1]); |
|
|
|
console.log(data); |
|
|
|
solarchart.sd_lastwindata = Date.now(); |
|
|
|
solarchart.series[consumDataIdx].setData(data.consumption, false); |
|
|
|
solarchart.series[gridDataIdx].setData(data.grid, false); |
|
|
|
solarchart.series[prodDataIdx].setData(data.production, false); |
|
|
|
solarchart.get('consumption').setData(data.consumption, false); |
|
|
|
solarchart.get('grid').setData(data.grid, false); |
|
|
|
solarchart.get('production').setData(data.production, false); |
|
|
|
solarchart.redraw(); |
|
|
|
solarchart.hideLoading() |
|
|
|
} |
|
|
@@ -86,18 +86,21 @@ var solarchart = Highcharts.stockChart('solarchart', { |
|
|
|
{ |
|
|
|
type: 'bar', |
|
|
|
name: 'consumptionNav', |
|
|
|
id: 'consumptionNav', |
|
|
|
showInNavigator: true, |
|
|
|
data: [], |
|
|
|
}, |
|
|
|
{ |
|
|
|
type: 'bar', |
|
|
|
name: 'gridNav', |
|
|
|
id: 'gridNav', |
|
|
|
showInNavigator: true, |
|
|
|
data: [], |
|
|
|
}, |
|
|
|
{ |
|
|
|
type: 'bar', |
|
|
|
name: 'productionNav', |
|
|
|
id: 'productionNav', |
|
|
|
showInNavigator: true, |
|
|
|
data: [], |
|
|
|
}, |
|
|
@@ -137,37 +140,21 @@ var solarchart = Highcharts.stockChart('solarchart', { |
|
|
|
series: [ |
|
|
|
{ |
|
|
|
name: 'consumption', |
|
|
|
id: 'consumption', |
|
|
|
type: 'line', |
|
|
|
data: [ ], |
|
|
|
}, |
|
|
|
{ |
|
|
|
name: 'grid', |
|
|
|
id: 'grid', |
|
|
|
type: 'line', |
|
|
|
data: [ ], |
|
|
|
}, |
|
|
|
{ |
|
|
|
name: 'production', |
|
|
|
id: 'production', |
|
|
|
type: 'line', |
|
|
|
data: [ ], |
|
|
|
}, |
|
|
|
] |
|
|
|
}); |
|
|
|
|
|
|
|
// Indexes for chart series |
|
|
|
delete solarchart.navigator.series[0]; |
|
|
|
for (var idx in solarchart.navigator.series) { |
|
|
|
if (solarchart.navigator.series[idx].name == 'consumptionNav') |
|
|
|
consumIdx = idx; |
|
|
|
else if (solarchart.navigator.series[idx].name == 'gridNav') |
|
|
|
gridIdx = idx; |
|
|
|
else if (solarchart.navigator.series[idx].name == 'productionNav') |
|
|
|
prodIdx = idx; |
|
|
|
} |
|
|
|
for (var idx in solarchart.series) { |
|
|
|
if (solarchart.series[idx].name == 'consumption') |
|
|
|
consumDataIdx = idx; |
|
|
|
else if (solarchart.series[idx].name == 'grid') |
|
|
|
gridDataIdx = idx; |
|
|
|
else if (solarchart.series[idx].name == 'production') |
|
|
|
prodDataIdx = idx; |
|
|
|
} |