Giter Site home page Giter Site logo

it is not ascii chart about asciichart HOT 4 CLOSED

kroitor avatar kroitor commented on May 22, 2024 3
it is not ascii chart

from asciichart.

Comments (4)

evert avatar evert commented on May 22, 2024 2

I just ran into this as well. This is how it looks like on my vt320

img_20190125_144126

from asciichart.

DoktorJ avatar DoktorJ commented on May 22, 2024 1

FWIW the option has been reimplemented at this point, so you can specify the characters you want to use (such as "+", "-", "|", "/", "" or whatever else).

from asciichart.

kroitor avatar kroitor commented on May 22, 2024

Yep, thanks, I agree! This is not an ASCII chart to be formally strict. The box-drawing symbols were initially configurable, later I decided to remove that option, but the title remained the same.

from asciichart.

kroitor avatar kroitor commented on May 22, 2024

@evert wow! cool term, man! )

In order to display it in true ASCII 0-127, you can change the drawing symbols, like so:

        for (let y = min2; y <= max2; ++y) { // axis + labels
            let label = format (max - (y - min2) * range / rows, y - min2)
            result[y - min2][Math.max (offset - label.length, 0)] = label
            result[y - min2][offset - 1] = (y == 0) ? '┼' : '┤'  // ←--------- change this to + and |
        }

        let y0 = Math.round (series[0] * ratio) - min2
        result[rows - y0][offset - 1] = '┼' // first value // ←--------- change this to +

        for (let x = 0; x < series.length - 1; x++) { // plot the line
            let y0 = Math.round (series[x + 0] * ratio) - min2
            let y1 = Math.round (series[x + 1] * ratio) - min2
            if (y0 == y1) {
                result[rows - y0][x + offset] = '─' // ←-------- change this to a dash -
            } else {
                result[rows - y1][x + offset] = (y0 > y1) ? '╰' : '╭' // ←- change this to \ and /
                result[rows - y0][x + offset] = (y0 > y1) ? '╮' : '╯' // ←- change this to \ and /
                let from = Math.min (y0, y1)
                let to = Math.max (y0, y1)
                for (let y = from + 1; y < to; y++) {
                    result[rows - y][x + offset] = '│' // ← change this to a small vertical bar |
                }
            }
        }

↑ that, however, requires editing the source code of the package. I'll think on restoring config options for drawing symbols as well.

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.