|
|
|
@ -17,244 +17,302 @@
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
var palette = new Rickshaw.Color.Palette({scheme: "classic9"});
|
|
|
|
|
var graphMap = {};
|
|
|
|
|
|
|
|
|
|
function drawGraph_connectedcup(from, to) {
|
|
|
|
|
$("#y_axis-temperature").html("");
|
|
|
|
|
$("#smoother-temperature").html("");
|
|
|
|
|
$("#legend-temperature").html("");
|
|
|
|
|
$("#chart-temperature").html("");
|
|
|
|
|
$("#x_axis-temperature").html("");
|
|
|
|
|
$("#slider-temperature").html("");
|
|
|
|
|
|
|
|
|
|
$("#y_axis-coffeelevel").html("");
|
|
|
|
|
$("#smoother-coffeelevel").html("");
|
|
|
|
|
$("#legend-coffeelevel").html("");
|
|
|
|
|
$("#chart-coffeelevel").html("");
|
|
|
|
|
$("#x_axis-coffeelevel").html("");
|
|
|
|
|
$("#slider-coffeelevel").html("");
|
|
|
|
|
|
|
|
|
|
var devices = $("#connectedcup-details").data("devices");
|
|
|
|
|
var tzOffset = new Date().getTimezoneOffset() * 60;
|
|
|
|
|
|
|
|
|
|
var streamIndex = 0;
|
|
|
|
|
var streams = ["temperature", "coffeelevel"];
|
|
|
|
|
var chartWrapperElmId = "#connectedcup-div-chart";
|
|
|
|
|
var graphWidth = $(chartWrapperElmId).width() - 50;
|
|
|
|
|
var temperatureGraphConfig = {
|
|
|
|
|
element: document.getElementById("chart-temperature"),
|
|
|
|
|
width: graphWidth,
|
|
|
|
|
height: 400,
|
|
|
|
|
strokeWidth: 2,
|
|
|
|
|
renderer: 'line',
|
|
|
|
|
interpolation: "linear",
|
|
|
|
|
unstack: true,
|
|
|
|
|
stack: false,
|
|
|
|
|
xScale: d3.time.scale(),
|
|
|
|
|
padding: {top: 0.2, left: 0.02, right: 0.02, bottom: 0.2},
|
|
|
|
|
series: []
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
populateGraph();
|
|
|
|
|
var coffeelevelGraphConfig = {
|
|
|
|
|
element: document.getElementById("chart-coffeelevel"),
|
|
|
|
|
width: graphWidth,
|
|
|
|
|
height: 400,
|
|
|
|
|
strokeWidth: 2,
|
|
|
|
|
renderer: 'line',
|
|
|
|
|
interpolation: "linear",
|
|
|
|
|
unstack: true,
|
|
|
|
|
stack: false,
|
|
|
|
|
xScale: d3.time.scale(),
|
|
|
|
|
padding: {top: 0.2, left: 0.02, right: 0.02, bottom: 0.2},
|
|
|
|
|
series: []
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
function populateGraph() {
|
|
|
|
|
if (streamIndex < 2) {
|
|
|
|
|
retrieveDataAndDrawLineGraph(streams[streamIndex], from, to);
|
|
|
|
|
if (devices) {
|
|
|
|
|
for (var i = 0; i < devices.length; i++) {
|
|
|
|
|
temperatureGraphConfig['series'].push(
|
|
|
|
|
{
|
|
|
|
|
'color': palette.color(),
|
|
|
|
|
'data': [{
|
|
|
|
|
x: parseInt(new Date().getTime() / 1000),
|
|
|
|
|
y: 0
|
|
|
|
|
}],
|
|
|
|
|
'name': devices[i].name
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
coffeelevelGraphConfig['series'].push(
|
|
|
|
|
{
|
|
|
|
|
'color': palette.color(),
|
|
|
|
|
'data': [{
|
|
|
|
|
x: parseInt(new Date().getTime() / 1000),
|
|
|
|
|
y: 0
|
|
|
|
|
}],
|
|
|
|
|
'name': devices[i].name
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
streamIndex++;
|
|
|
|
|
} else {
|
|
|
|
|
temperatureGraphConfig['series'].push(
|
|
|
|
|
{
|
|
|
|
|
'color': palette.color(),
|
|
|
|
|
'data': [{
|
|
|
|
|
x: parseInt(new Date().getTime() / 1000),
|
|
|
|
|
y: 0
|
|
|
|
|
}],
|
|
|
|
|
'name': $("#connectedcup-details").data("devicename")
|
|
|
|
|
});
|
|
|
|
|
coffeelevelGraphConfig['series'].push(
|
|
|
|
|
{
|
|
|
|
|
'color': palette.color(),
|
|
|
|
|
'data': [{
|
|
|
|
|
x: parseInt(new Date().getTime() / 1000),
|
|
|
|
|
y: 0
|
|
|
|
|
}],
|
|
|
|
|
'name': $("#connectedcup-details").data("devicename")
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function clearContent(type) {
|
|
|
|
|
$("#y_axis-" + type).html("");
|
|
|
|
|
$("#smoother-" + type).html("");
|
|
|
|
|
$("#legend-" + type).html("");
|
|
|
|
|
$("#chart-" + type).html("");
|
|
|
|
|
$("#x_axis-" + type).html("");
|
|
|
|
|
$("#slider-" + type).html("");
|
|
|
|
|
}
|
|
|
|
|
var temperatureGraph = new Rickshaw.Graph(temperatureGraphConfig);
|
|
|
|
|
var coffeelevelGraph = new Rickshaw.Graph(coffeelevelGraphConfig);
|
|
|
|
|
|
|
|
|
|
function initGraph(type, isMultilined) {
|
|
|
|
|
if (graphMap[type]) {
|
|
|
|
|
return graphMap[type];
|
|
|
|
|
}
|
|
|
|
|
temperatureGraph.render();
|
|
|
|
|
coffeelevelGraph.render
|
|
|
|
|
|
|
|
|
|
var chartWrapperElmId = "#connectedcup-div-chart";
|
|
|
|
|
var graphWidth = $(chartWrapperElmId).width() - 50;
|
|
|
|
|
|
|
|
|
|
var graphConfig = {
|
|
|
|
|
element: document.getElementById("chart-" + type),
|
|
|
|
|
width: graphWidth,
|
|
|
|
|
height: 400,
|
|
|
|
|
strokeWidth: 2,
|
|
|
|
|
renderer: 'line',
|
|
|
|
|
interpolation: "linear",
|
|
|
|
|
unstack: true,
|
|
|
|
|
stack: false,
|
|
|
|
|
xScale: d3.time.scale(),
|
|
|
|
|
padding: {top: 0.2, left: 0.02, right: 0.02, bottom: 0.2},
|
|
|
|
|
series: []
|
|
|
|
|
};
|
|
|
|
|
var xAxisTemepature = new Rickshaw.Graph.Axis.Time({
|
|
|
|
|
graph: temperatureGraph
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (devices) {
|
|
|
|
|
for (var i = 0; i < devices.length; i++) {
|
|
|
|
|
graphConfig['series'].push(
|
|
|
|
|
{
|
|
|
|
|
'color': palette.color(),
|
|
|
|
|
'data': [{
|
|
|
|
|
x: parseInt(new Date().getTime() / 1000),
|
|
|
|
|
y: 0
|
|
|
|
|
}],
|
|
|
|
|
'name': devices[i].name
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (isMultilined) {
|
|
|
|
|
graphConfig['series'].push(
|
|
|
|
|
{
|
|
|
|
|
'color': palette.color(),
|
|
|
|
|
'data': [{
|
|
|
|
|
x: parseInt(new Date().getTime() / 1000),
|
|
|
|
|
y: 0
|
|
|
|
|
}],
|
|
|
|
|
'name': "x"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
'color': palette.color(),
|
|
|
|
|
'data': [{
|
|
|
|
|
x: parseInt(new Date().getTime() / 1000),
|
|
|
|
|
y: 0
|
|
|
|
|
}],
|
|
|
|
|
'name': "y"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
'color': palette.color(),
|
|
|
|
|
'data': [{
|
|
|
|
|
x: parseInt(new Date().getTime() / 1000),
|
|
|
|
|
y: 0
|
|
|
|
|
}],
|
|
|
|
|
'name': "z"
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
graphConfig['series'].push(
|
|
|
|
|
{
|
|
|
|
|
'color': palette.color(),
|
|
|
|
|
'data': [{
|
|
|
|
|
x: parseInt(new Date().getTime() / 1000),
|
|
|
|
|
y: 0
|
|
|
|
|
}],
|
|
|
|
|
'name': $("#connectedcup-details").data("devicename")
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
xAxisTemepature.render();
|
|
|
|
|
|
|
|
|
|
var graph = new Rickshaw.Graph(graphConfig);
|
|
|
|
|
graph.render();
|
|
|
|
|
var xAxisCoffeelevel = new Rickshaw.Graph.Axis.Time({
|
|
|
|
|
graph: coffeelevelGraph
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var xAxis = new Rickshaw.Graph.Axis.Time({
|
|
|
|
|
graph: graph
|
|
|
|
|
});
|
|
|
|
|
xAxis.render();
|
|
|
|
|
|
|
|
|
|
var yAxis = new Rickshaw.Graph.Axis.Y({
|
|
|
|
|
graph: graph,
|
|
|
|
|
orientation: 'left',
|
|
|
|
|
element: document.getElementById("y_axis-" + type),
|
|
|
|
|
width: 40,
|
|
|
|
|
height: 410
|
|
|
|
|
});
|
|
|
|
|
yAxis.render();
|
|
|
|
|
xAxisCoffeelevel.render();
|
|
|
|
|
|
|
|
|
|
var slider = new Rickshaw.Graph.RangeSlider.Preview({
|
|
|
|
|
graph: graph,
|
|
|
|
|
element: document.getElementById("slider-" + type)
|
|
|
|
|
});
|
|
|
|
|
var yAxisTemperature = new Rickshaw.Graph.Axis.Y({
|
|
|
|
|
graph: temperatureGraph,
|
|
|
|
|
orientation: 'left',
|
|
|
|
|
element: document.getElementById("y_axis-temperature"),
|
|
|
|
|
width: 40,
|
|
|
|
|
height: 410
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var legend = new Rickshaw.Graph.Legend({
|
|
|
|
|
graph: graph,
|
|
|
|
|
element: document.getElementById("legend-" + type)
|
|
|
|
|
});
|
|
|
|
|
yAxisTemperature.render();
|
|
|
|
|
|
|
|
|
|
var hoverDetail = new Rickshaw.Graph.HoverDetail({
|
|
|
|
|
graph: graph,
|
|
|
|
|
formatter: function (series, x, y) {
|
|
|
|
|
var date = '<span class="date">' +
|
|
|
|
|
moment((x + tzOffset) * 1000).format('Do MMM YYYY h:mm:ss a') + '</span>';
|
|
|
|
|
var swatch = '<span class="detail_swatch" style="background-color: ' +
|
|
|
|
|
series.color + '"></span>';
|
|
|
|
|
return swatch + series.name + ": " + parseInt(y) + '<br>' + date;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var shelving = new Rickshaw.Graph.Behavior.Series.Toggle({
|
|
|
|
|
graph: graph,
|
|
|
|
|
legend: legend
|
|
|
|
|
});
|
|
|
|
|
var yAxisCoffeelevel = new Rickshaw.Graph.Axis.Y({
|
|
|
|
|
graph: coffeelevelGraph,
|
|
|
|
|
orientation: 'left',
|
|
|
|
|
element: document.getElementById("y_axis-coffeelevel"),
|
|
|
|
|
width: 40,
|
|
|
|
|
height: 410
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var order = new Rickshaw.Graph.Behavior.Series.Order({
|
|
|
|
|
graph: graph,
|
|
|
|
|
legend: legend
|
|
|
|
|
});
|
|
|
|
|
yAxisCoffeelevel.render();
|
|
|
|
|
|
|
|
|
|
var highlighter = new Rickshaw.Graph.Behavior.Series.Highlight({
|
|
|
|
|
graph: graph,
|
|
|
|
|
legend: legend
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
graphMap[type] = {};
|
|
|
|
|
graphMap[type].graph = graph;
|
|
|
|
|
graphMap[type].config = graphConfig;
|
|
|
|
|
return graphMap[type];
|
|
|
|
|
}
|
|
|
|
|
var slider = new Rickshaw.Graph.RangeSlider.Preview({
|
|
|
|
|
graph: temperatureGraph,
|
|
|
|
|
element: document.getElementById("slider-temperature")
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
function retrieveDataAndDrawLineGraph(type, from, to) {
|
|
|
|
|
clearContent(type);
|
|
|
|
|
var legend = new Rickshaw.Graph.Legend({
|
|
|
|
|
graph: temperatureGraph,
|
|
|
|
|
element: document.getElementById('legend-temperature')
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var graphObj = initGraph(type, false);
|
|
|
|
|
var graph = graphObj.graph;
|
|
|
|
|
var graphConfig = graphObj.config;
|
|
|
|
|
var sliderCoffee = new Rickshaw.Graph.RangeSlider.Preview({
|
|
|
|
|
graph: coffeelevelGraph,
|
|
|
|
|
element: document.getElementById("slider-coffeelevel")
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var deviceIndex = 0;
|
|
|
|
|
var legendCoffee = new Rickshaw.Graph.Legend({
|
|
|
|
|
graph: coffeelevelGraph,
|
|
|
|
|
element: document.getElementById('legend-coffeelevel')
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (devices) {
|
|
|
|
|
getData();
|
|
|
|
|
} else {
|
|
|
|
|
var backendApiUrl = $("#connectedcup-div-chart").data("backend-api-url") + type + "?from=" + from + "&to=" + to;
|
|
|
|
|
var successCallback = function (data) {
|
|
|
|
|
if (data) {
|
|
|
|
|
drawLineGraph(JSON.parse(data));
|
|
|
|
|
}
|
|
|
|
|
populateGraph();
|
|
|
|
|
};
|
|
|
|
|
invokerUtil.get(backendApiUrl, successCallback, function (message) {
|
|
|
|
|
console.log(message);
|
|
|
|
|
populateGraph();
|
|
|
|
|
});
|
|
|
|
|
var hoverDetail = new Rickshaw.Graph.HoverDetail({
|
|
|
|
|
graph: temperatureGraph,
|
|
|
|
|
formatter: function (series, x, y) {
|
|
|
|
|
var date = '<span class="date">' +
|
|
|
|
|
moment((x + tzOffset) * 1000).format('Do MMM YYYY h:mm:ss a') + '</span>';
|
|
|
|
|
var swatch = '<span class="detail_swatch" style="background-color: ' +
|
|
|
|
|
series.color + '"></span>';
|
|
|
|
|
return swatch + series.name + ": " + parseInt(y) + '<br>' + date;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
function getData() {
|
|
|
|
|
if (deviceIndex >= devices.length) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
var backendApiUrl = $("#connectedcup-div-chart").data("backend-api-url") + devices[deviceIndex].deviceIdentifier
|
|
|
|
|
+ "/sensors/" + type + "?from=" + from + "&to=" + to;
|
|
|
|
|
var successCallback = function (data) {
|
|
|
|
|
if (data) {
|
|
|
|
|
drawLineGraph(JSON.parse(data));
|
|
|
|
|
}
|
|
|
|
|
deviceIndex++;
|
|
|
|
|
getData();
|
|
|
|
|
};
|
|
|
|
|
invokerUtil.get(backendApiUrl, successCallback, function (message) {
|
|
|
|
|
console.log(message);
|
|
|
|
|
deviceIndex++;
|
|
|
|
|
getData();
|
|
|
|
|
});
|
|
|
|
|
var hoverDetailCoffeelevel = new Rickshaw.Graph.HoverDetail({
|
|
|
|
|
graph: coffeelevelGraph,
|
|
|
|
|
formatter: function (series, x, y) {
|
|
|
|
|
var date = '<span class="date">' +
|
|
|
|
|
moment((x + tzOffset) * 1000).format('Do MMM YYYY h:mm:ss a') + '</span>';
|
|
|
|
|
var swatch = '<span class="detail_swatch" style="background-color: ' +
|
|
|
|
|
series.color + '"></span>';
|
|
|
|
|
return swatch + series.name + ": " + parseInt(y) + '<br>' + date;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var shelving = new Rickshaw.Graph.Behavior.Series.Toggle({
|
|
|
|
|
graph: temperatureGraph,
|
|
|
|
|
legend: legend
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
function drawLineGraph(data) {
|
|
|
|
|
if (data.length === 0 || data.length === undefined) {
|
|
|
|
|
return;
|
|
|
|
|
var order = new Rickshaw.Graph.Behavior.Series.Order({
|
|
|
|
|
graph: temperatureGraph,
|
|
|
|
|
legend: legend
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var highlighter = new Rickshaw.Graph.Behavior.Series.Highlight({
|
|
|
|
|
graph: temperatureGraph,
|
|
|
|
|
legend: legend
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var shelvingCoffee = new Rickshaw.Graph.Behavior.Series.Toggle({
|
|
|
|
|
graph: coffeelevelGraph,
|
|
|
|
|
legend: legendCoffee
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var orderCoffee = new Rickshaw.Graph.Behavior.Series.Order({
|
|
|
|
|
graph: coffeelevelGraph,
|
|
|
|
|
legend: legendCoffee
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var highlighterCoffee = new Rickshaw.Graph.Behavior.Series.Highlight({
|
|
|
|
|
graph: coffeelevelGraph,
|
|
|
|
|
legend: legendCoffee
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var deviceIndex = 0;
|
|
|
|
|
|
|
|
|
|
if (devices) {
|
|
|
|
|
getData();
|
|
|
|
|
} else {
|
|
|
|
|
var backendApiUrl = $("#connectedcup-div-chart").data("backend-api-url") + "/sensors/temperature" + "?from=" + from + "&to=" + to;
|
|
|
|
|
var successCallback = function (data) {
|
|
|
|
|
if (data) {
|
|
|
|
|
drawTemperatureLineGraph(JSON.parse(data));
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
invokerUtil.get(backendApiUrl, successCallback, function (message) {
|
|
|
|
|
console.log(message);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var chartData = [];
|
|
|
|
|
for (var i = 0; i < data.length; i++) {
|
|
|
|
|
chartData.push(
|
|
|
|
|
{
|
|
|
|
|
x: parseInt(data[i].values.time) - tzOffset,
|
|
|
|
|
y: parseInt(getFieldData(data[i], type))
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
var coffeeLevelApiUrl = $("#connectedcup-div-chart").data("backend-api-url") + "/sensors/coffeelevel"
|
|
|
|
|
+ "?from=" + from + "&to=" + to;
|
|
|
|
|
var successCallbackCoffeeLevel = function (data) {
|
|
|
|
|
if (data) {
|
|
|
|
|
drawCoffeeLevelLineGraph(JSON.parse(data));
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
invokerUtil.get(coffeeLevelApiUrl, successCallbackCoffeeLevel, function (message) {
|
|
|
|
|
console.log(message);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
graphConfig.series[deviceIndex].data = chartData;
|
|
|
|
|
graph.update();
|
|
|
|
|
function getData() {
|
|
|
|
|
if (deviceIndex >= devices.length) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
var backendApiUrl = $("#connectedcup-div-chart").data("backend-api-url") + devices[deviceIndex].deviceIdentifier
|
|
|
|
|
+ "/sensors/temperature"
|
|
|
|
|
+ "?from=" + from + "&to=" + to;
|
|
|
|
|
var successCallback = function (data) {
|
|
|
|
|
if (data) {
|
|
|
|
|
drawTemperatureLineGraph(JSON.parse(data));
|
|
|
|
|
}
|
|
|
|
|
deviceIndex++;
|
|
|
|
|
getData();
|
|
|
|
|
};
|
|
|
|
|
invokerUtil.get(backendApiUrl, successCallback, function (message) {
|
|
|
|
|
console.log(message);
|
|
|
|
|
deviceIndex++;
|
|
|
|
|
getData();
|
|
|
|
|
});
|
|
|
|
|
var coffeeLevelApiUrl = $("#connectedcup-div-chart").data("backend-api-url") + devices[deviceIndex].deviceIdentifier
|
|
|
|
|
+ "/sensors/coffeelevel" + "?from=" + from + "&to=" + to;
|
|
|
|
|
|
|
|
|
|
var successCallbackCoffeeLevel = function (data) {
|
|
|
|
|
if (data) {
|
|
|
|
|
drawCoffeeLevelLineGraph(JSON.parse(data));
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
invokerUtil.get(coffeeLevelApiUrl, successCallbackCoffeeLevel, function (message) {
|
|
|
|
|
console.log(message);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getFieldData(data, type) {
|
|
|
|
|
var columnData;
|
|
|
|
|
switch (type) {
|
|
|
|
|
case "temperature" :
|
|
|
|
|
columnData = data.values.temperature;
|
|
|
|
|
break;
|
|
|
|
|
case "coffeelevel" :
|
|
|
|
|
columnData = data.values.coffeelevel;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
function drawTemperatureLineGraph(data) {
|
|
|
|
|
if (data.length === 0 || data.length === undefined) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var chartData = [];
|
|
|
|
|
for (var i = 0; i < data.length; i++) {
|
|
|
|
|
chartData.push(
|
|
|
|
|
{
|
|
|
|
|
x: parseInt(data[i].values.time) - tzOffset,
|
|
|
|
|
y: parseInt(data[i].values.temperature)
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return columnData;
|
|
|
|
|
temperatureGraphConfig.series[deviceIndex].data = chartData;
|
|
|
|
|
temperatureGraph.update();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function drawCoffeeLevelLineGraph(data) {
|
|
|
|
|
if (data.length === 0 || data.length === undefined) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var chartData = [];
|
|
|
|
|
for (var i = 0; i < data.length; i++) {
|
|
|
|
|
chartData.push(
|
|
|
|
|
{
|
|
|
|
|
x: parseInt(data[i].values.time) - tzOffset,
|
|
|
|
|
y: parseInt(data[i].values.coffeelevel)
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
coffeelevelGraphConfig.series[deviceIndex].data = chartData;
|
|
|
|
|
coffeelevelGraph.update();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|