Hi,
I have this flow:
[{"id":"b54ac0ad.8454c","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"83ded079.88b0e","type":"mui_ui_control","z":"b54ac0ad.8454c","name":"","x":359.0000305175781,"y":113.00000143051147,"wires":[["601667d4.55e128"]]},{"id":"601667d4.55e128","type":"function","z":"b54ac0ad.8454c","name":"","func":"if(msg.payload == 'connect'){\n \n return msg;\n}\n","outputs":1,"noerr":0,"x":544.0000495910645,"y":162.800048828125,"wires":[["6518630e.3c324c"]]},{"id":"6518630e.3c324c","type":"function","z":"b54ac0ad.8454c","name":"","func":"var id_32821 = flow.get(\"32821\");\nvar id_32822 = flow.get(\"32822\");\nvar id_32823 = flow.get(\"32823\");\nvar id_32824 = flow.get(\"32824\");\nvar id_32825 = flow.get(\"32825\");\nvar query = [];\nquery.push({tagId: 32821})\nquery.push({tagId: 32822})\nquery.push({tagId: 32823})\nquery.push({tagId: 32824})\nquery.push({tagId: 32825})\nmsg.payload = {$or: query};\nreturn msg;\n\n","outputs":1,"noerr":0,"x":632.000072479248,"y":222.00000262260437,"wires":[["55c484a2.3f413c"]]},{"id":"55c484a2.3f413c","type":"mongodb2 in","z":"b54ac0ad.8454c","service":"_ext_","configNode":"bd3d666a.0cba18","name":"db query","collection":"xxxxx","operation":"find.toArray","x":730.4000244140625,"y":124.20000267028809,"wires":[["ab557d37.67b04"]]},{"id":"ab557d37.67b04","type":"function","z":"b54ac0ad.8454c","name":"Alarm data","func":"var data_fin = [];\nvar label_fin = [];\nvar result_data = [];\nvar result_label = [];\nvar date = new Date();\nvar series = [];\nvar last_n_days = [];\ndate.setDate(date.getDate());\nlast_n_days = [date.getFullYear() + '-' + (date.getMonth()+1) + '-' + (date.getDate()-4),\n date.getFullYear() + '-' + (date.getMonth()+1) + '-' + (date.getDate()-3),\n date.getFullYear() + '-' + (date.getMonth()+1) + '-' + (date.getDate()-2),\n date.getFullYear() + '-' + (date.getMonth()+1) + '-' + (date.getDate()-1),\n date.getFullYear() + '-' + (date.getMonth()+1) + '-' + (date.getDate())];\n\n\n\nfor(i=0;i<msg.payload.length;i++){\n ///\n \n var timestamp = [];\n \n timestamp = msg.payload[i]['timestamp']\n series.push(msg.payload[i]['tagId'].toString())\n var data = [];\n // preparazione dati\n for(j=0;j<timestamp.length;j++){\n data.push(timestamp[j].split(\" \")[0])\n }\n \n // conteggio occorrenze\n var counts = {};\n for (x = 0; x < data.length; x++) {\n var num = data[x];\n counts[num] = counts[num] ? counts[num] + 1 : 1;\n }\n // preparazione output\n var fin_data = []\n var fin_label = []\n for(z=0; z<Object.keys(counts).length;z++){\n lab_tmp = Object.keys(counts)[z]\n tmp_data = counts[Object.keys(counts)[z]];\n fin_data.push(tmp_data);\n fin_label.push(lab_tmp)\n }\n var d = [];\n for(var j=0; j<last_n_days.length;j++){\n d.push(0)\n }\n for(j=0; j<fin_label.length;j++){\n for(var k=0;k<last_n_days.length;k++){\n if(fin_label[j] === last_n_days[k]){\n d[k] = fin_data[j]\n }\n }\n }\n \n data_fin.push(d)\n}\nmsg.payload = \"\";\nmsg.payload = [{\n \"series\": series,\n \"data\": data_fin,\n \"labels\": last_n_days\n \n}];\nmsg.topic = \"Alarm chart\"; \n\n//msg.payload = d\nreturn msg;\n\n\n","outputs":1,"noerr":0,"x":876.2000274658203,"y":220.2000026702881,"wires":[["c55a9477.d0ca68"]]},{"id":"c55a9477.d0ca68","type":"mui_chart","z":"b54ac0ad.8454c","name":"","group":"4b99c03.fd2684","order":2,"width":"14","height":"5","label":"Grafico degli allarmi","chartType":"line","legend":"true","xformat":" ","interpolate":"linear","nodata":"No data...","dot":true,"ymin":"0","ymax":"5","removeOlder":"5","removeOlderPoints":"5","removeOlderUnit":"86400","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":1010.0001602172852,"y":132.00000286102295,"wires":[[],[]]},{"id":"bd3d666a.0cba18","type":"mongodb2","z":"","uri":"xxxx", "name":"xxxxx","options":"","parallelism":"-1"},{"id":"4b99c03.fd2684","type":"mui_group","z":"","name":" Alarm zone","tab":"f057f260.9b6eb","order":5,"disp":false,"width":"22","collapse":false},{"id":"f057f260.9b6eb","type":"mui_tab","z":"","name":"Costa Bassa Dashboard","icon":"dashboard","order":1}]
but the line chart doesn't show the timestamp, but show correctly the point on the graph. Also, it show a grid with a huge number of cell. Any idea?
Thanks