OK this has me puzzled.
My original node flow looks like this:
This returns graph posted above. The function Extract Temperature looks like this:
var time=[];
var temp=[];
var deviceid=[];
var time_float = 0;
var temp_float=0;
var i=0;
var dataarray = [[]];
for (i=0; i< msg.payload.ScannedCount; i++) {
time = Object.values(msg.payload.Items[i].time);
temp = Object.values(msg.payload.Items[i].payload.M.Temperature);
time_float = Number(time[0])*1000;
temp_float = Number(temp[0]);
dataarray[0][i] = {"x":time_float,"y":temp_float};
}
var chart = [{
"series":["Temperature ="],
"data":dataarray,
"labels":[""]
}];
msg.payload = chart;
return msg;
However, when I re-create the node with some input data using the code below, the graph displays the x-axis correctly.
[{"id":"5e52f683.e88988","type":"function","z":"3d772458.67327c","name":"Extract Temperature","func":"var time=[];\nvar temp=[];\nvar time_float = 0;\nvar temp_float=0;\n\ntemp[0] = 24.5\ntemp[1] = 26\ntemp[2] = 28\ntemp[3] = 30\n\ntime[0] = 1552215913000\ntime[1] = 1552218111000 \ntime[2] = 1552225320000 \ntime[3] = 1552232527000\n\nvar i=0;\nvar dataarray = [[]];\n\nfor (i=0; i< 4; i++) {\ntime_float = Number(time[i]);\ntemp_float = Number(temp[i]);\ndataarray[0][i] = {\"x\":time_float,\"y\":temp_float};\n\n}\n\nvar chart = [{\n \"series\":[\"Temperature =\"],\n \"data\":dataarray,\n \"labels\":[\"\"]\n}];\n\nmsg.payload = chart;\n\nreturn msg;\n\n","outputs":1,"noerr":0,"x":553,"y":262,"wires":[["c57af1f0.79a22","2768353f.11f2fa"]]},{"id":"2a1aac7.6cad654","type":"inject","z":"3d772458.67327c","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":305,"y":266,"wires":[["5e52f683.e88988"]]},{"id":"c57af1f0.79a22","type":"ui_chart","z":"3d772458.67327c","name":"","group":"788afba5.70ef64","order":0,"width":"5","height":"8","label":"","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"bezier","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":"24","removeOlderPoints":"0","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#14aee4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#ffffff"],"useOldStyle":false,"outputs":1,"x":806,"y":265,"wires":[[]]},{"id":"2768353f.11f2fa","type":"debug","z":"3d772458.67327c","name":"TEST","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":794,"y":146,"wires":[]},{"id":"788afba5.70ef64","type":"ui_group","z":"","name":"Temperature (°C)","tab":"54f8799a.3418b8","order":1,"disp":true,"width":"6","collapse":false},{"id":"54f8799a.3418b8","type":"ui_tab","z":"","name":"Sensatech - Device 1CEE2B","icon":"dashboard","disabled":false,"hidden":false}]