How can i custom the time start and end of the chart that get the data from my API

i wanna adjust the time (both start and end ) in the chart ?
how can i do this ?

My flow are as follow :

[{"id":"25c3e47b.ae7f9c","type":"tab","label":"historial data","disabled":false,"info":""},{"id":"7cc467c2.c31eb8","type":"debug","z":"25c3e47b.ae7f9c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":760,"y":260,"wires":[]},{"id":"baa627a9.bee228","type":"inject","z":"25c3e47b.ae7f9c","name":"","topic":"","payload":"{\"value\": \"abcdefghijklmnopqrstuvwxyz0123\"}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":310,"y":240,"wires":[["7cc467c2.c31eb8"]],"info":"[{\n\"series\": [\"A\", \"B\", \"C\"],\n\"data\": [\n    [{ \"x\": 1504029632890, \"y\": 5 },\n     { \"x\": 1504029636001, \"y\": 4 },\n     { \"x\": 1504029638656, \"y\": 2 }\n    ],\n    [{ \"x\": 1504029633514, \"y\": 6 },\n     { \"x\": 1504029636622, \"y\": 7 },\n     { \"x\": 1504029639539, \"y\": 6 }\n    ],\n    [{ \"x\": 1504029634400, \"y\": 7 },\n     { \"x\": 1504029637959, \"y\": 7 },\n     { \"x\": 1504029640317, \"y\": 7 }\n    ]\n],\n\"labels\": [\"\"]\n}]"},{"id":"934dec7b.fda26","type":"inject","z":"25c3e47b.ae7f9c","name":"","topic":"","payload":"[]","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":590,"y":420,"wires":[[]]},{"id":"b07fa340.4e498","type":"function","z":"25c3e47b.ae7f9c","name":"Setup payload","func":"series = [];\ndata = [];\nlabels = [];\n\nseries.push(\"Field1\");\nlabels.push(\"Field1\");\ndata.push(msg.data);\n\nmsg.payload = [{\"series\":series, \"data\":data,\"labels\": labels}];\n\nreturn msg;","outputs":1,"noerr":0,"x":540,"y":360,"wires":[["8b4bf7e8.955448"]]},{"id":"1ea20a7c.020706","type":"function","z":"25c3e47b.ae7f9c","name":"Dataset","func":"msg.payload = {\n    \"-LcgJ2ryhWC4d7tVOX1X\": {\n        \"score\": \"1\",\n        \"ts\": \"2018-10-08T14:25:17Z\"\n    },\n    \"-LcgJ2sr0o9mu26pEKUn\": {\n        \"score\": \"2\",\n        \"ts\": \"2018-10-08T14:34:58Z\"\n    },\n    \"-LcgJ2ryhWC4d7tVOX1A\": {\n        \"score\": \"3\",\n        \"ts\": \"2018-10-08T14:44:36Z\"\n    }\n}\n\n//let data =[];\n//for (let prop in msg.payload) {\n//    data.push({\"x\":msg.payload[prop].ts, \"y\":msg.payload[prop].score});\n//}\n\n//msg.data = data;\nreturn msg;","outputs":1,"noerr":0,"x":280,"y":360,"wires":[["47f5881a.ab0028","97a2afbb.0dfae"]]},{"id":"a05ac41d.6e1998","type":"inject","z":"25c3e47b.ae7f9c","name":"Trigger","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":360,"wires":[["1ea20a7c.020706"]]},{"id":"8b4bf7e8.955448","type":"debug","z":"25c3e47b.ae7f9c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":750,"y":360,"wires":[]},{"id":"5626f29e.0b4ddc","type":"inject","z":"25c3e47b.ae7f9c","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":160,"y":620,"wires":[["994f180b.c80ff8"]]},{"id":"994f180b.c80ff8","type":"function","z":"25c3e47b.ae7f9c","name":"insert API key","func":"var idToken = msg.payload.idToken\nmsg = {}\nmsg.payload = {}\nmsg.headers = {};\nmsg.headers['api-key'] = 'wtVkzZPTdVyfDfk9zIlnBpoINYA=';\n//msg.Headers['Authorization'] = \"Bearer \" +\"1ea1ab00-8978-44e9-a003-7f657a153031\";\nreturn msg;","outputs":1,"noerr":0,"x":380,"y":600,"wires":[["ad6dbac4.5b01c8"]]},{"id":"ad6dbac4.5b01c8","type":"http request","z":"25c3e47b.ae7f9c","name":"","method":"GET","ret":"obj","paytoqs":false,"url":"http://api.heclouds.com/devices/576330540/datapoints? datastream_id=3311_0_5851&start=2019-12-30T17:12:33&end=2020-01-17T17:22:33&limit=20000","tls":"","persist":false,"proxy":"","authType":"","x":570,"y":600,"wires":[["c718f201.636a5","6ae06abe.1ac424","30ceee4c.224562","b8ad5e85.7c5c7","5f2b9819.28fc58"]]},{"id":"6ae06abe.1ac424","type":"debug","z":"25c3e47b.ae7f9c","name":"debug history data","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1070,"y":320,"wires":[]},{"id":"c718f201.636a5","type":"switch","z":"25c3e47b.ae7f9c","name":"","property":"payload.data.devices[0].datastreams[0].id","propertyType":"msg","rules":[{"t":"eq","v":"3311_0_5851","vt":"str"},{"t":"eq","v":"3311_0_5706","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":490,"y":740,"wires":[[],[]]},{"id":"13cb84f8.bfaa9b","type":"function","z":"25c3e47b.ae7f9c","name":"timeframe","func":"payload.data.datastreams[1].datapoints[0].at\npayload.data.datastreams[1].datapoints[0].at\npayload.data.datastreams[1].datapoints[1].at\n\n\nreturn msg;","outputs":1,"noerr":0,"x":250,"y":720,"wires":[[]]},{"id":"d88ff9d0.125f48","type":"function","z":"25c3e47b.ae7f9c","name":"dataframe","func":"payload.data.datastreams[1].datapoints[0].value\npayload.data.datastreams[1].datapoints[1].value\nreturn msg;","outputs":1,"noerr":0,"x":250,"y":780,"wires":[[]]},{"id":"2b540166.4128de","type":"function","z":"25c3e47b.ae7f9c","name":"Setup payload","func":"series = [];\ndata = [];\nlabels = [];\n\nseries.push(\"Battery\");\nlabels.push(\"Labels\");\ndata.push(msg.data);\n\nmsg.payload = [{\"series\":series, \"data\":data,\"labels\": labels}];\n\nreturn msg;","outputs":1,"noerr":0,"x":1160,"y":540,"wires":[["9dc71df4.76eff","3bd08307.515fcc"]]},{"id":"30ceee4c.224562","type":"function","z":"25c3e47b.ae7f9c","name":"log count","func":"msg.payload = msg.payload.data.count;\nreturn msg;","outputs":1,"noerr":0,"x":860,"y":700,"wires":[["980fe654.f77208"]]},{"id":"9dc71df4.76eff","type":"debug","z":"25c3e47b.ae7f9c","name":"test","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1470,"y":540,"wires":[]},{"id":"47f5881a.ab0028","type":"function","z":"25c3e47b.ae7f9c","name":"Dataset","func":"let data =[];\nfor (let prop in msg.payload) {\n    data.push({\"x\":msg.payload[prop].ts, \"y\":msg.payload[prop].score});\n}\n\nmsg.data = data;\nreturn msg;","outputs":1,"noerr":0,"x":360,"y":440,"wires":[["b07fa340.4e498"]]},{"id":"28e32c22.430bc4","type":"function","z":"25c3e47b.ae7f9c","name":"","func":"\nreturn msg;","outputs":1,"noerr":0,"x":950,"y":480,"wires":[["420d4958.396798","5f2b9819.28fc58"]]},{"id":"420d4958.396798","type":"debug","z":"25c3e47b.ae7f9c","name":"test2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1130,"y":480,"wires":[]},{"id":"19fb4c0d.de7374","type":"function","z":"25c3e47b.ae7f9c","name":"","func":"payload.data.datastreams[0].datapoints\npayload[\"-LcgJ2ryhWC4d7tVOX1X\"].ts\nreturn msg;","outputs":1,"noerr":0,"x":260,"y":840,"wires":[[]]},{"id":"97a2afbb.0dfae","type":"debug","z":"25c3e47b.ae7f9c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":420,"y":300,"wires":[]},{"id":"6574518e.e8c5a","type":"function","z":"25c3e47b.ae7f9c","name":"prepare data strukture for chart with Javascript","func":"let r = msg.payload;\nlet serie = [r[0].sensorName];\nlet data = [r.map( v => ({\n    \"x\": v.timeStamp,\n    \"y\": v.value\n}))]; \n\nmsg.payload = [{\"series\": serie, \"data\": data}]; \nreturn msg;","outputs":1,"noerr":0,"x":220,"y":960,"wires":[[]]},{"id":"ef38afe1.42401","type":"debug","z":"25c3e47b.ae7f9c","name":"test3","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1110,"y":780,"wires":[]},{"id":"5f2b9819.28fc58","type":"function","z":"25c3e47b.ae7f9c","name":"set to graph format","func":"var total = msg.payload.data.datastreams[1].datapoints.length;\n///var total = msg.payload.data.count;\n//var total = global.count;\n//var total = context.get('count');\n//var total = parseInt(msg.payload.data.count,10);\n//var total = Number(msg.payload.data.count);\n//abcd = total.toFixed(1);\nlet data =[];\n//for (let prop in msg.payload) {\n//    data.push({\"x\":msg.payload.data.datastreams[1].datapoints[prop].value, \"y\":msg.payload[prop].at});\n//}\n\nfor (var i = 0; i<total; i++){\n    data.push({\"x\":msg.payload.data.datastreams[1].datapoints[i].at, \"y\":msg.payload.data.datastreams[1].datapoints[i].value});\n}\n//payload.data.datastreams[1].datapoints[0].value\n\nmsg.data = data;\nreturn msg;","outputs":1,"noerr":0,"x":910,"y":540,"wires":[["2b540166.4128de"]]},{"id":"3bd08307.515fcc","type":"ui_chart","z":"25c3e47b.ae7f9c","name":"","group":"6c9560a6.bd813","order":3,"width":"0","height":"0","label":" Voltage","chartType":"line","legend":"false","xformat":"auto","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":"100","removeOlderPoints":"1000","removeOlderUnit":"604800","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":1480,"y":600,"wires":[[]]},{"id":"980fe654.f77208","type":"debug","z":"25c3e47b.ae7f9c","name":"number of log","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1140,"y":700,"wires":[]},{"id":"88b5bfb3.54283","type":"change","z":"25c3e47b.ae7f9c","name":"","rules":[{"t":"set","p":"payload.data.count;","pt":"msg","to":"count","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":840,"y":780,"wires":[["ef38afe1.42401"]]},{"id":"fc32b17f.16083","type":"ui_slider","z":"25c3e47b.ae7f9c","name":"","label":"slider","tooltip":"","group":"6c9560a6.bd813","order":3,"width":0,"height":0,"passthru":true,"outs":"all","topic":"","min":"10","max":"20","step":1,"x":1350,"y":380,"wires":[["7eee7bd2.cf42c4"]]},{"id":"89897c39.b75b","type":"ui_numeric","z":"25c3e47b.ae7f9c","name":"","label":"numeric","tooltip":"","group":"6c9560a6.bd813","order":4,"width":0,"height":0,"wrap":false,"passthru":true,"topic":"","format":"{{value}}","min":0,"max":10,"step":1,"x":1580,"y":300,"wires":[[]]},{"id":"b8ad5e85.7c5c7","type":"change","z":"25c3e47b.ae7f9c","name":"","rules":[{"t":"set","p":"payload.data.count;","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":620,"y":840,"wires":[["5babb775.677898"]]},{"id":"35a46b1a.b21034","type":"debug","z":"25c3e47b.ae7f9c","name":"test4","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1170,"y":840,"wires":[]},{"id":"bf71dc13.db977","type":"change","z":"25c3e47b.ae7f9c","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":80,"y":520,"wires":[[]],"info":"return msg"},{"id":"dbf98c3a.87045","type":"function","z":"25c3e47b.ae7f9c","name":"","func":"msg.payload = Number(msg.payload);\nreturn msg;","outputs":1,"noerr":0,"x":990,"y":840,"wires":[["35a46b1a.b21034"]]},{"id":"5babb775.677898","type":"json","z":"25c3e47b.ae7f9c","name":"","property":"payload","action":"","pretty":false,"x":840,"y":840,"wires":[["dbf98c3a.87045"]]},{"id":"7eee7bd2.cf42c4","type":"function","z":"25c3e47b.ae7f9c","name":"time function","func":"\nreturn msg;","outputs":1,"noerr":0,"x":1430,"y":300,"wires":[["89897c39.b75b"]]},{"id":"b41e52ce.4235a","type":"ui_dropdown","z":"25c3e47b.ae7f9c","name":"1234","label":"","tooltip":"","place":"Select option","group":"6c9560a6.bd813","order":3,"width":"3","height":"1","passthru":true,"options":[{"label":"","value":"","type":"str"}],"payload":"","topic":"","x":1050,"y":400,"wires":[[]]},{"id":"6c9560a6.bd813","type":"ui_group","z":"","name":"water_test","tab":"a68e51ff.bf5e4","disp":true,"width":"20","collapse":false},{"id":"a68e51ff.bf5e4","type":"ui_tab","z":"","name":"meter","icon":"dashboard","disabled":false,"hidden":false}]

and i hope that the something like :::
https://www.youtube.com/watch?v=nkKf26oKzhQ&t=771s

thanks if anyone can help

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.