Suddenly I found a problem in chart if it not time series.
Please, look on x-axis number on popup.
Hi
Really strange value for sure. But not too much information to make any guess what is wrong or where to investigate.
So if you can please share flow. Or at least share how your chart is configured and what is the expected value at that point
Also the data injection rules if there is any and data format.
The function for chart
That's usable but also the chart node configuration is needed to make test case similar to yours.
Please when posting flows or code copy/paste rather than screenshot, so we don't have to retype it. Use the </>
button at the top of the forum text window so that the forum will not mess with it.
Why are you coding your loops like
for (var s = 1; s < 1000; s++) {
speed[s-1] = 0
}
rather than the more usual
for (var s = 0; s < 999; s++) {
speed[s] = 0
}
I forgot why, just now tested your code it works, but doesn't solve a problem.
Can you export your test function node and the chart node and paste them here so we can test it ourselves please. Select the necessary nodes then Export from the menu and Copy to Clipboard. Then paste it here using the </>
button at the top of the forum text entry window to stop the forum messing with the text.
Also tell us which version of node-red and the dashboard you are using.
[{"id":"484d7609.e3d6b8","type":"function","z":"8d3c155c.9a7458","name":"","func":"var m=0\nvar dat = []\nvar lab =[]\nvar speed =[]\n\nfor (var i = 0; i < 1001; i++) {\n dat[i] = Math.random()* (0.8 - 0.3) + 0.3\n}\n\nfor (var t = 0; t < 1001; t++) {\n lab[t] = t\n}\n\n\nfor (var s = 0; s < 1001; s++) {\n speed[s] = 1\n}\n\n\nmsg.payload = [{\n \"series\": [\"КСЦ\", \"Скорость/100 км/ч\"],\n \"data\": [dat,speed],\n \"labels\": lab, lab\n}]\nreturn msg;","outputs":1,"noerr":0,"x":390,"y":860,"wires":[["3ed36360.50a87c"]]}]
dashboard version 2.23.4
node-red v1.0.1
You haven't included the chart node.
[{"id":"484d7609.e3d6b8","type":"function","z":"8d3c155c.9a7458","name":"","func":"var m=0\nvar dat = []\nvar lab =[]\nvar speed =[]\n\nfor (var i = 0; i < 1001; i++) {\n dat[i] = Math.random()* (0.8 - 0.3) + 0.3\n}\n\nfor (var t = 0; t < 1001; t++) {\n lab[t] = t\n}\n\n\nfor (var s = 0; s < 1001; s++) {\n speed[s] = 1\n}\n\n\nmsg.payload = [{\n \"series\": [\"КСЦ\", \"Скорость/100 км/ч\"],\n \"data\": [dat,speed],\n \"labels\": lab, lab\n}]\nreturn msg;","outputs":1,"noerr":0,"x":390,"y":860,"wires":[["3ed36360.50a87c"]]},{"id":"3ed36360.50a87c","type":"ui_chart","z":"8d3c155c.9a7458","name":"","group":"a94cbd17.fda17","order":14,"width":18,"height":4,"label":"Прямой проезд","chartType":"line","legend":"false","xformat":"auto","interpolate":"bezier","nodata":"","dot":false,"ymin":"0","ymax":"1","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#1f77b4","#ff0000","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":660,"y":540,"wires":[[]]},{"id":"a94cbd17.fda17","type":"ui_group","z":"","name":"Измерение","tab":"1164e41c.99dfcc","order":1,"disp":false,"width":"18","collapse":false},{"id":"1164e41c.99dfcc","type":"ui_tab","z":"","name":"Измерение","icon":"dashboard","order":2,"disabled":false,"hidden":true}]
I can confirm I am seeing the same issue, though it took me a couple of minutes to realise that the tab had been marked as not visible in the navigation menu so I couldn't even see it.
[Edit] Strange, I refreshed the page with the developer console up (in Chrome) and suddenly the popup is showing the correct value but the X axis is trying to showing timestamps, which are complete rubbish of course.
After further investigation if I change something and do a full deploy then the x axis is correct but the popup is wrong, then if I refresh the page the popup is correct but the x-axis is wrong. Nothing obvious in the browser developer console.
In Firefox (81.0.2) the X axis labels work all the time but the popup doesn't have the X axis value at all.
I'm not sure but I think there is too old moment.js in use with angular-chart.js
This option comes with 2.10.5
moment().calendar(null, {
sameDay: '[Today]',
nextDay: '[Tomorrow]',
nextWeek: 'dddd',
lastDay: '[Yesterday]',
lastWeek: '[Last] dddd',
sameElse: 'DD/MM/YYYY'
});
But as far I could trace seems to me that the chart comes with 2.8. or something like this.
This is just one big guess and nothing proved ...
I don't know how, In the chart config, the chart knows that the x axis should not be interpreted as a timestamp.
No formatting for x-axis in case of automatic
That doesn't seem to be the case for me. I have a time base chart that works as expected and with HH:MM:SS it shows on the x axis, for example, 08:00:00 and if I set it to automatic it shows Oct 21, 8AM. The popup still shows 08:00:00 though so the popup seems to use different formatting to the axis.
There is i'd think some difference in case of live data and stored data. But having no more free time to dig into sources ..
OK, that makes sense.