Closed alextran1502 closed 4 years ago
Hi! What's your programming language?
hello @kroitor I am using Javascript
@alextran1502 assuming you can read the data points from your stream, you can add them to the set of most recent maxLength elements in your array of data upon reading, and then redraw the chart using the most recent elements. In the simplest form it would look like:
const maxLength = 80
const numbers = []
while (true) {
const number = readFromStream () // your reading logic here
if (numbers.length >= maxLength) {
numbers.shift ()
}
numbers.push (number)
console.log (plot (numbers))
}
Let me know if that does not answer the question. Feel free to reopen this if needed or just ask further questions, if any.
@kroitor commented on Feb 28, 2020, 10:13 AM GMT+3:30:
@alextran1502 assuming you can read the data points from your stream, you can add them to the set of most recent maxLength elements in your array of data upon reading, and then redraw the chart using the most recent elements. In the simplest form it would look like:
const maxLength = 80 const numbers = [] while (true) { const number = readFromStream () // your reading logic here if (numbers.length >= maxLength) { numbers.shift () } numbers.push (number) console.log (plot (numbers)) }
Let me know if that does not answer the question. Feel free to reopen this if needed or just ask further questions, if any.
I want to just plot the streaming data (each new line being the updated value) from stdin. How do I do that?
Hello,
First of all, thank you for your wonderful job. This is a very good library.
I am trying to graph a stream of data, can you help to point me in the right direction.
Thanks