[
{
"id": "6a22305c.5135a",
"type": "inject",
"z": "d388adbc.37c1c",
"name": "Influx Query results",
"topic": "Time-Series sample",
"payload": "[ \t[ \t\t{ \t\t \"time\": \"2016-12-01T19:59:04.619Z\", \t\t \"value\": \"22\" \t\t}, \t\t{ \t\t \"time\": \"2016-12-01T20:09:05.578Z\", \t\t \"value\": \"20.5\" \t\t}, \t\t{ \t\t \"time\": \"2016-12-01T20:17:24.808Z\", \t\t \"value\": \"20\" \t\t}, \t\t{ \t\t \"time\": \"2016-12-01T20:37:24.81Z\", \t\t \"value\": \"19.5\" \t\t}, \t\t{ \t\t \"time\": \"2016-12-01T20:47:24.812Z\", \t\t \"value\": \"19\" \t\t}, \t\t{ \t\t \"time\": \"2016-12-01T20:57:24.813Z\", \t\t \"value\": \"20\" \t\t}, \t\t{ \t\t \"time\": \"2016-12-01T21:17:24.816Z\", \t\t \"value\": \"21\" \t\t}, \t\t{ \t\t \"time\": \"2016-12-01T21:37:24.819Z\", \t\t \"value\": \"21.5\" \t\t}, \t\t{ \t\t \"time\": \"2016-12-01T21:47:24.821Z\", \t\t \"value\": \"20\" \t\t} \t], \t[ \t\t{ \t\t \"time\": \"2016-12-01T19:59:04.619Z\", \t\t \"value\": \"12\" \t\t}, \t\t{ \t\t \"time\": \"2016-12-01T20:09:05.578Z\", \t\t \"value\": \"12.5\" \t\t}, \t\t{ \t\t \"time\": \"2016-12-01T20:17:24.808Z\", \t\t \"value\": \"12\" \t\t}, \t\t{ \t\t \"time\": \"2016-12-01T20:37:24.81Z\", \t\t \"value\": \"13.5\" \t\t}, \t\t{ \t\t \"time\": \"2016-12-01T20:47:24.812Z\", \t\t \"value\": \"15\" \t\t}, \t\t{ \t\t \"time\": \"2016-12-01T20:57:24.813Z\", \t\t \"value\": \"16.5\" \t\t}, \t\t{ \t\t \"time\": \"2016-12-01T21:17:24.816Z\", \t\t \"value\": \"14\" \t\t}, \t\t{ \t\t \"time\": \"2016-12-01T21:37:24.819Z\", \t\t \"value\": \"12.5\" \t\t}, \t\t{ \t\t \"time\": \"2016-12-01T21:47:24.821Z\", \t\t \"value\": \"11\" \t\t} \t] ]",
"payloadType": "json",
"repeat": "",
"crontab": "",
"once": false,
"x": 150,
"y": 420,
"wires": [
[
"3d4fcd5e.de1d22",
"6daa4bcb.026414"
]
]
},
{
"id": "6daa4bcb.026414",
"type": "change",
"z": "d388adbc.37c1c",
"name": "Plotly data formatter",
"rules": [
{
"t": "set",
"p": "data",
"pt": "msg",
"to": "msg.payload.\t{\t \"x\": [time],\t \"y\": [value],\t \"mode\": \"lines+markers\"\t}",
"tot": "jsonata"
},
{
"t": "set",
"p": "layout",
"pt": "msg",
"to": "{\t \"title\": msg.topic\t}",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 320,
"y": 500,
"wires": [
[
"91149cf2.19ee9",
"f72c73d1.c59c2"
]
]
},
{
"id": "91149cf2.19ee9",
"type": "ui_template",
"z": "d388adbc.37c1c",
"group": "6179fa60.1ff7e4",
"name": "Plotly chart",
"order": 1,
"width": "0",
"height": "0",
"format": "<script src=\"
https://cdn.plot.ly/plotly-latest.min.js\"></script>\n\n<div id=\"myPlot\" style=\"width: 400px; height: 300px;\">\n <!-- Plotly chart will be drawn inside this DIV -->\n</div>\n\n<script>\n var points = [];\n var layout = { mode: \"line\" };\n //var plotly = Plotly.newPlot(\"myPlot\", points, layout);\n\n// Lambda function to access the Angular Scope \n;(function(scope) { \n //Have to use $watch - as we can't directly access $scope - so we pick up new, incoming msg's \n scope.$watch('msg.data', function(newVal, oldVal) { \n console.log('- Scope.msg -') \n console.dir(scope.msg)\n\n if (scope.msg && scope.msg.data) {\n var img;\n createPlot(scope.msg.data, scope.msg.layout)\n .then(function(gd) {\n img = Plotly.toImage(gd, {\n format: 'png',\n height: 400,\n width: 300\n })\n .then(function(raw) {\n scope.msg.payload = raw;\n scope.send(scope.msg);\n })\n })\n }\n })\n})(scope);\n\nfunction createPlot(data, opts) {\n points = data;\n layout = opts;\n return Plotly.newPlot(\"myPlot\", data, opts);\n};\n\n</script>",
"storeOutMessages": false,
"fwdInMessages": false,
"x": 630,
"y": 500,
"wires": [
[
"6acb86b8.659a38"
]
]
},
{
"id": "6acb86b8.659a38",
"type": "debug",
"z": "d388adbc.37c1c",
"name": "",
"active": true,
"console": "false",
"complete": "payload",
"x": 830,
"y": 500,
"wires": []
},
{
"id": "f72c73d1.c59c2",
"type": "debug",
"z": "d388adbc.37c1c",
"name": "",
"active": true,
"console": "false",
"complete": "true",
"x": 530,
"y": 560,
"wires": []
},
{
"id": "6179fa60.1ff7e4",
"type": "ui_group",
"z": "",
"name": "Plotly Data",
"tab": "43ebf368.6e761c",
"order": 4,
"disp": true,
"width": "8"
},
{
"id": "43ebf368.6e761c",
"type": "ui_tab",
"z": "",
"name": "Query Data",
"icon": "dashboard",
"order": 1
}
]