Firstly I process the data thus (from the first output from my node and pass it to a influxdb out node.
[{"id":"b6058e53.fd887","type":"function","z":"8dea1bec.971898","name":"Format for InfluxDB","func":"var newmsg = {};\nnewmsg.payload = [];\n\nmsg.payload.results.forEach(myFunc);\n\nfunction myFunc(item, index) {\n newmsg.payload.push([{ value_inc_vat : item.value_inc_vat, \n \"time\": new Date(item.valid_from).getTime() *1000 *1000}, {\"source\" : \"Agile\"}]);\n}\n\nnewmsg.measurement = \"OctopusPrice\"\n\nreturn newmsg;","outputs":1,"noerr":0,"x":470,"y":300,"wires":[["f61144e.fc690b8","79898d8d.cddcc4"]]}]
You don’t then need a query in InfluxDB just Grafana (linked to the db of course).
First time try to export JSON from Grafana - how does this work?
{
"datasource": null,
"aliasColors": {},
"bars": true,
"dashLength": 10,
"dashes": false,
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 10,
"w": 7,
"x": 0,
"y": 0
},
"hiddenSeries": false,
"id": 2,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": false,
"total": false,
"values": false
},
"lines": false,
"linewidth": 1,
"nullPointMode": "null",
"options": {
"dataLinks": []
},
"percentage": false,
"pointradius": 2,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"groupBy": [],
"measurement": "OctopusPrice",
"orderByTime": "ASC",
"policy": "default",
"query": "SELECT \"value_inc_vat\" FROM \"OctopusPrice\" WHERE $timeFilter",
"rawQuery": true,
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value_inc_vat"
],
"type": "field"
}
]
],
"tags": []
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Agile Pricing",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
}
Time range
When you try and share the panel deselect the current time range option so it updates.