All Projects → kroitor → Asciichart

kroitor / Asciichart

Licence: mit
Nice-looking lightweight console ASCII line charts ╭┈╯ for NodeJS, browsers and terminal, no dependencies

Programming Languages

javascript
184084 projects - #8 most used programming language
python
139335 projects - #7 most used programming language
js
455 projects

Projects that are alternatives of or similar to Asciichart

asciichart-sharp
C# port of asciichart
Stars: ✭ 27 (-97.56%)
Mutual labels:  console, chart, charting-library, ascii, plot, charting
Asciigraph
Go package to make lightweight ASCII line graph ╭┈╯ in command line apps with no other dependencies.
Stars: ✭ 1,805 (+63.05%)
Mutual labels:  terminal, graph, chart, plot, charting-library
Ervy
Bring charts to terminal.
Stars: ✭ 1,530 (+38.21%)
Mutual labels:  terminal, console, ascii, chart
Colorette
Easily set the color and style of text in the terminal.
Stars: ✭ 1,047 (-5.42%)
Mutual labels:  terminal, console, ansi, browser
Ttyplot
a realtime plotting utility for terminal/console with data input from stdin
Stars: ✭ 532 (-51.94%)
Mutual labels:  console, graph, chart, plot
Tcharts.js
📉 Lightweight and fast terminal ASCII charts for nodejs and browser.
Stars: ✭ 172 (-84.46%)
Mutual labels:  terminal, console, ascii, chart
Amcharts4
The most advanced amCharts charting library for JavaScript and TypeScript apps.
Stars: ✭ 907 (-18.07%)
Mutual labels:  graph, chart, charting-library, charting
ascii chart
Nice-looking lightweight console ASCII line charts ╭┈╯. Port of kroitor/asciichart.
Stars: ✭ 24 (-97.83%)
Mutual labels:  console, chart, ascii
Chalk
🖍 Terminal string styling done right
Stars: ✭ 17,566 (+1486.81%)
Mutual labels:  terminal, console, ansi
Enigma Bbs
ENiGMA½ BBS Software
Stars: ✭ 294 (-73.44%)
Mutual labels:  terminal, ascii, ansi
Mordant
Full-featured text styling for Kotlin command-line applications
Stars: ✭ 382 (-65.49%)
Mutual labels:  terminal, console, ansi
Colorful
Terminal string styling done right, in Python 🐍 🎉
Stars: ✭ 456 (-58.81%)
Mutual labels:  terminal, console, ansi
HCLineChartView
HCLineChartView is a beautiful iOS library for drawing line charts. It is highly customizable and easy to use.
Stars: ✭ 22 (-98.01%)
Mutual labels:  chart, charting-library, charting
Csconsoleformat
.NET C# library for advanced formatting of console output [Apache]
Stars: ✭ 296 (-73.26%)
Mutual labels:  terminal, console, ascii
smag
Show Me A Graph - Command Line Graphing
Stars: ✭ 78 (-92.95%)
Mutual labels:  console, chart, plot
Uplot
📈 A small, fast chart for time series, lines, areas, ohlc & bars
Stars: ✭ 6,808 (+515%)
Mutual labels:  graph, chart, plot
Terminaltables
Generate simple tables in terminals from a nested list of strings.
Stars: ✭ 685 (-38.12%)
Mutual labels:  terminal, console, ascii
Rang
A Minimal, Header only Modern c++ library for terminal goodies 💄✨
Stars: ✭ 1,080 (-2.44%)
Mutual labels:  terminal, console, ansi
Termenv
Advanced ANSI style & color support for your terminal applications
Stars: ✭ 555 (-49.86%)
Mutual labels:  terminal, console, ansi
Sadconsole
A .NET ascii/ansi console engine written in C# for MonoGame and XNA. Create your own text roguelike (or other) games!
Stars: ✭ 853 (-22.94%)
Mutual labels:  console, ascii, ansi

asciichart

npm PyPI Travis Coverage Status license

Console ASCII line charts in pure Javascript (for NodeJS and browsers) with no dependencies.

Console ASCII Line charts in pure Javascript (for NodeJS and browsers)

Usage

NodeJS

npm install asciichart
var asciichart = require ('asciichart')
var s0 = new Array (120)
for (var i = 0; i < s0.length; i++)
    s0[i] = 15 * Math.sin (i * ((Math.PI * 4) / s0.length))
console.log (asciichart.plot (s0))

Browsers

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <meta charset="UTF-8">
        <title>asciichart</title>
        <script src="asciichart.js"></script>
        <script type="text/javascript">
            var s0 = new Array (120)
            for (var i = 0; i < s0.length; i++)
                s0[i] = 15 * Math.sin (i * ((Math.PI * 4) / s0.length))
            console.log (asciichart.plot (s0))
        </script>
    </head>
    <body>
    </body>
</html>

Options

The width of the chart will always equal the length of data series. The height and range are determined automatically.

var s0 = new Array (120)
for (var i = 0; i < s0.length; i++)
    s0[i] = 15 * Math.sin (i * ((Math.PI * 4) / s0.length))
console.log (asciichart.plot (s0))
Console ASCII Line charts in pure Javascript (for NodeJS and browsers)

The output can be configured by passing a second parameter to the plot (series, config) function. The following options are supported:

var config = {

    offset:  3,          // axis offset from the left (min 2)
    padding: '       ',  // padding string for label formatting (can be overridden)
    height:  10,         // any height you want

    // the label format function applies default padding
    format:  function (x, i) { return (padding + x.toFixed (2)).slice (-padding.length) }
}

Scale To Desired Height

Console ASCII Line charts in pure Javascript (for NodeJS and browsers)
var s = []
for (var i = 0; i < 120; i++)
    s[i] = 15 * Math.cos (i * ((Math.PI * 8) / 120)) // values range from -15 to +15
console.log (asciichart.plot (s, { height: 6 }))     // this rescales the graph to ±3 lines
Console ASCII Line charts in pure Javascript (for NodeJS and browsers)

Auto-range

var s2 = new Array (120)
s2[0] = Math.round (Math.random () * 15)
for (i = 1; i < s2.length; i++)
    s2[i] = s2[i - 1] + Math.round (Math.random () * (Math.random () > 0.5 ? 2 : -2))
console.log (asciichart.plot (s2))
Console ASCII Line charts in pure Javascript (for NodeJS and browsers)

Multiple Series

var s2 = new Array (120)
s2[0] = Math.round (Math.random () * 15)
for (i = 1; i < s2.length; i++)
    s2[i] = s2[i - 1] + Math.round (Math.random () * (Math.random () > 0.5 ? 2 : -2))

var s3 = new Array (120)
s3[0] = Math.round (Math.random () * 15)
for (i = 1; i < s3.length; i++)
    s3[i] = s3[i - 1] + Math.round (Math.random () * (Math.random () > 0.5 ? 2 : -2))

console.log (asciichart.plot ([ s2, s3 ]))
Console ASCII Line charts in pure Javascript (for NodeJS and browsers)

Colors

var arr1 = new Array (120)
arr1[0] = Math.round (Math.random () * 15)
for (i = 1; i < arr1.length; i++)
    arr1[i] = arr1[i - 1] + Math.round (Math.random () * (Math.random () > 0.5 ? 2 : -2))

var arr2 = new Array (120)
arr2[0] = Math.round (Math.random () * 15)
for (i = 1; i < arr2.length; i++)
    arr2[i] = arr2[i - 1] + Math.round (Math.random () * (Math.random () > 0.5 ? 2 : -2))

var arr3 = new Array (120)
arr3[0] = Math.round (Math.random () * 15)
for (i = 1; i < arr3.length; i++)
    arr3[i] = arr3[i - 1] + Math.round (Math.random () * (Math.random () > 0.5 ? 2 : -2))

var arr4 = new Array (120)
arr4[0] = Math.round (Math.random () * 15)
for (i = 1; i < arr4.length; i++)
    arr4[i] = arr4[i - 1] + Math.round (Math.random () * (Math.random () > 0.5 ? 2 : -2))

var config = {
    colors: [
        asciichart.blue,
        asciichart.green,
        asciichart.default, // default color
        undefined, // equivalent to default
    ]
}

console.log (asciichart.plot([ arr1, arr2, arr3, arr4 ], config))
Console ASCII Line charts in pure Javascript (for NodeJS and browsers)

See Also

A util by madnight for drawing Bitcoin/Ether/altcoin charts in command-line console: bitcoin-chart-cli.

bitcoin-chart-cli

Ports

Special thx to all who helped port it to other languages, great stuff!

Future work (coming soon, hopefully)

  • levels and points on the graph!
  • even better value formatting and auto-scaling!

preview

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].