Coder Social home page Coder Social logo

Comments (5)

kroitor avatar kroitor commented on May 12, 2024 1

@NightMachinary you could have the chat in a separate blessed window and redraw it when your data changes. In other words, you need to locate your chart in your output and redraw it, by overwriting it.

from asciichart.

kroitor avatar kroitor commented on May 12, 2024

Hi! What's your programming language?

from asciichart.

alextran1502 avatar alextran1502 commented on May 12, 2024

hello @kroitor I am using Javascript

from asciichart.

kroitor avatar kroitor commented on May 12, 2024

@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.

from asciichart.

NightMachinery avatar NightMachinery commented on May 12, 2024

@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?

from asciichart.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.