@betterthings/plainchart

0.0.1 • Public • Published

PlainChart

A text-based, no-dependencies, open-source charting utility in JavaScript. It is inspired by the Python library plainchart.

Usage

import PlainChart from "@betterthings/plainchart";
const chart = new PlainChart([3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 9]);
console.log(chart.render());

/*

     ▌     ▌
     ▌     ▌
     ▌     ▌
     ▌ ▌   ▌
    ▌▌ ▌▌ ▌▌
    ▌▌ ▌▌ ▌▌
  ▌ ▌▌ ▌▌ ▌▌
▌ ▌ ▌▌ ▌▌▌▌▌
▌ ▌ ▌▌▌▌▌▌▌▌
▌▌▌▌▌▌▌▌▌▌▌▌

*/

Take a look at example.mjs to see how to generate something like this:

         ××××××××                                          ××××××××
      ×××        ×××                                    ×××        ×××
    ××              ××                                ××              ××
  ××                  ××                            ××                  ××
 ×                      ×                          ×                      ×
×                        ××                      ××                        ××                      ×
                           ××                  ××                            ××                  ××
                             ××              ××                                ××              ××
                               ×××        ×××                                    ×××        ×××
                                  ××××××××                                          ××××××××

Example

node --experimental-modules example.mjs

Contribute

Please feel free to open an issue to propose a new feature or point out a bug. You can also fork the PlainChart repository and submit a pull request.

Authors

Package Sidebar

Install

npm i @betterthings/plainchart

Weekly Downloads

1

Version

0.0.1

License

MIT

Unpacked Size

5.29 kB

Total Files

5

Last publish

Collaborators

  • laooola
  • lusbuab