{"id":13527943,"url":"https://github.com/kroitor/asciichart","last_synced_at":"2025-05-13T16:11:14.163Z","repository":{"id":41124641,"uuid":"81535817","full_name":"kroitor/asciichart","owner":"kroitor","description":"Nice-looking lightweight console ASCII line charts ╭┈╯ for NodeJS, browsers and terminal, no dependencies","archived":false,"fork":false,"pushed_at":"2025-02-23T21:09:07.000Z","size":315,"stargazers_count":1941,"open_issues_count":21,"forks_count":96,"subscribers_count":31,"default_branch":"master","last_synced_at":"2025-04-23T21:57:06.729Z","etag":null,"topics":["ansi","ascii","ascii-chart","browser","chart","charting","charting-library","charts","console","console-log","graph","javascript","js","line-charts","lines","node-js","nodejs","plot","terminal","text-chart"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kroitor.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-02-10T06:48:14.000Z","updated_at":"2025-04-22T12:21:41.000Z","dependencies_parsed_at":"2023-10-05T05:28:46.937Z","dependency_job_id":"2df8d9ab-ab06-423d-815f-5cf6b0714c94","html_url":"https://github.com/kroitor/asciichart","commit_stats":{"total_commits":250,"total_committers":21,"mean_commits":"11.904761904761905","dds":0.248,"last_synced_commit":"881ea27552eb06c31fde90f74e24afbd50bcf813"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kroitor%2Fasciichart","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kroitor%2Fasciichart/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kroitor%2Fasciichart/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kroitor%2Fasciichart/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kroitor","download_url":"https://codeload.github.com/kroitor/asciichart/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253980055,"owners_count":21994042,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansi","ascii","ascii-chart","browser","chart","charting","charting-library","charts","console","console-log","graph","javascript","js","line-charts","lines","node-js","nodejs","plot","terminal","text-chart"],"created_at":"2024-08-01T06:02:07.711Z","updated_at":"2025-05-13T16:11:14.099Z","avatar_url":"https://github.com/kroitor.png","language":"Python","funding_links":[],"categories":["Python","JavaScript"],"sub_categories":["Isomorphic"],"readme":"# asciichart\n\n[![npm](https://img.shields.io/npm/v/asciichart.svg)](https://npmjs.com/package/asciichart) [![PyPI](https://img.shields.io/pypi/v/asciichartpy.svg)](https://pypi.python.org/pypi/asciichartpy) [![Travis](https://travis-ci.org/kroitor/asciichart.svg?branch=master)](https://travis-ci.org/kroitor/asciichart) [![Coverage Status](https://coveralls.io/repos/github/kroitor/asciichart/badge.svg?branch=master)](https://coveralls.io/github/kroitor/asciichart?branch=master) [![license](https://img.shields.io/github/license/kroitor/asciichart.svg)](https://github.com/kroitor/asciichart/blob/master/LICENSE.txt)\n\nConsole ASCII line charts in pure Javascript (for NodeJS and browsers) with no dependencies.\n\n\u003cimg width=\"789\" alt=\"Console ASCII Line charts in pure Javascript (for NodeJS and browsers)\" src=\"https://cloud.githubusercontent.com/assets/1294454/22818709/9f14e1c2-ef7f-11e6-978f-34b5b595fb63.png\"\u003e\n\n## Usage\n\n### NodeJS\n\n```sh\nnpm install asciichart\n```\n\n```javascript\nvar asciichart = require ('asciichart')\nvar s0 = new Array (120)\nfor (var i = 0; i \u003c s0.length; i++)\n    s0[i] = 15 * Math.sin (i * ((Math.PI * 4) / s0.length))\nconsole.log (asciichart.plot (s0))\n```\n\n### Browsers\n\n```html\n\u003c!DOCTYPE html\u003e\n\u003chtml\u003e\n    \u003chead\u003e\n        \u003cmeta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"\u003e\n        \u003cmeta charset=\"UTF-8\"\u003e\n        \u003ctitle\u003easciichart\u003c/title\u003e\n        \u003cscript src=\"asciichart.js\"\u003e\u003c/script\u003e\n        \u003cscript type=\"text/javascript\"\u003e\n            var s0 = new Array (120)\n            for (var i = 0; i \u003c s0.length; i++)\n                s0[i] = 15 * Math.sin (i * ((Math.PI * 4) / s0.length))\n            console.log (asciichart.plot (s0))\n        \u003c/script\u003e\n    \u003c/head\u003e\n    \u003cbody\u003e\n    \u003c/body\u003e\n\u003c/html\u003e\n```\n\n### Options\n\nThe width of the chart will always equal the length of data series. The height and range are determined automatically.\n\n```javascript\nvar s0 = new Array (120)\nfor (var i = 0; i \u003c s0.length; i++)\n    s0[i] = 15 * Math.sin (i * ((Math.PI * 4) / s0.length))\nconsole.log (asciichart.plot (s0))\n```\n\n\u003cimg width=\"788\" alt=\"Console ASCII Line charts in pure Javascript (for NodeJS and browsers)\" src=\"https://cloud.githubusercontent.com/assets/1294454/22818807/313cd636-ef80-11e6-9d1a-7a90abdb38c8.png\"\u003e\n\nThe output can be configured by passing a second parameter to the `plot (series, config)` function. The following options are supported:\n```javascript\nvar config = {\n\n    offset:  3,          // axis offset from the left (min 2)\n    padding: '       ',  // padding string for label formatting (can be overridden)\n    height:  10,         // any height you want\n\n    // the label format function applies default padding\n    format:  function (x, i) { return (padding + x.toFixed (2)).slice (-padding.length) }\n}\n```\n\n### Scale To Desired Height\n\n\u003cimg width=\"791\" alt=\"Console ASCII Line charts in pure Javascript (for NodeJS and browsers)\" src=\"https://cloud.githubusercontent.com/assets/1294454/22818711/9f166128-ef7f-11e6-9748-b23b151974ed.png\"\u003e\n\n```javascript\nvar s = []\nfor (var i = 0; i \u003c 120; i++)\n    s[i] = 15 * Math.cos (i * ((Math.PI * 8) / 120)) // values range from -15 to +15\nconsole.log (asciichart.plot (s, { height: 6 }))     // this rescales the graph to ±3 lines\n```\n\n\u003cimg width=\"787\" alt=\"Console ASCII Line charts in pure Javascript (for NodeJS and browsers)\" src=\"https://cloud.githubusercontent.com/assets/1294454/22825525/dd295294-ef9e-11e6-93d1-0beb80b93133.png\"\u003e\n\n### Auto-range\n\n```javascript\nvar s2 = new Array (120)\ns2[0] = Math.round (Math.random () * 15)\nfor (i = 1; i \u003c s2.length; i++)\n    s2[i] = s2[i - 1] + Math.round (Math.random () * (Math.random () \u003e 0.5 ? 2 : -2))\nconsole.log (asciichart.plot (s2))\n```\n\n\u003cimg width=\"788\" alt=\"Console ASCII Line charts in pure Javascript (for NodeJS and browsers)\" src=\"https://cloud.githubusercontent.com/assets/1294454/22818710/9f157a74-ef7f-11e6-893a-f7494b5abef1.png\"\u003e\n\n### Multiple Series\n\n```javascript\nvar s2 = new Array (120)\ns2[0] = Math.round (Math.random () * 15)\nfor (i = 1; i \u003c s2.length; i++)\n    s2[i] = s2[i - 1] + Math.round (Math.random () * (Math.random () \u003e 0.5 ? 2 : -2))\n\nvar s3 = new Array (120)\ns3[0] = Math.round (Math.random () * 15)\nfor (i = 1; i \u003c s3.length; i++)\n    s3[i] = s3[i - 1] + Math.round (Math.random () * (Math.random () \u003e 0.5 ? 2 : -2))\n\nconsole.log (asciichart.plot ([ s2, s3 ]))\n```\n\n\u003cimg width=\"788\" alt=\"Console ASCII Line charts in pure Javascript (for NodeJS and browsers)\" src=\"https://user-images.githubusercontent.com/27967284/79398277-5322da80-7f91-11ea-8da8-e47976b76c12.png\"\u003e\n\n### Colors\n\n```javascript\nvar arr1 = new Array (120)\narr1[0] = Math.round (Math.random () * 15)\nfor (i = 1; i \u003c arr1.length; i++)\n    arr1[i] = arr1[i - 1] + Math.round (Math.random () * (Math.random () \u003e 0.5 ? 2 : -2))\n\nvar arr2 = new Array (120)\narr2[0] = Math.round (Math.random () * 15)\nfor (i = 1; i \u003c arr2.length; i++)\n    arr2[i] = arr2[i - 1] + Math.round (Math.random () * (Math.random () \u003e 0.5 ? 2 : -2))\n\nvar arr3 = new Array (120)\narr3[0] = Math.round (Math.random () * 15)\nfor (i = 1; i \u003c arr3.length; i++)\n    arr3[i] = arr3[i - 1] + Math.round (Math.random () * (Math.random () \u003e 0.5 ? 2 : -2))\n\nvar arr4 = new Array (120)\narr4[0] = Math.round (Math.random () * 15)\nfor (i = 1; i \u003c arr4.length; i++)\n    arr4[i] = arr4[i - 1] + Math.round (Math.random () * (Math.random () \u003e 0.5 ? 2 : -2))\n\nvar config = {\n    colors: [\n        asciichart.blue,\n        asciichart.green,\n        asciichart.default, // default color\n        undefined, // equivalent to default\n    ]\n}\n\nconsole.log (asciichart.plot([ arr1, arr2, arr3, arr4 ], config))\n```\n\n\u003cimg width=\"788\" alt=\"Console ASCII Line charts in pure Javascript (for NodeJS and browsers)\" src=\"https://user-images.githubusercontent.com/27967284/79398700-51a5e200-7f92-11ea-9048-8dbdeeb60830.png\"\u003e\n\n### See Also\n\nA util by [madnight](https://github.com/madnight) for drawing Bitcoin/Ether/altcoin charts in command-line console: [bitcoin-chart-cli](https://github.com/madnight/bitcoin-chart-cli).\n\n![bitcoin-chart-cli](https://camo.githubusercontent.com/494806efd925c4cd56d8370c1d4e8b751812030a/68747470733a2f2f692e696d6775722e636f6d2f635474467879362e706e67)\n\n### Ports\n\nSpecial thx to all who helped port it to other languages, great stuff!\n\n- [Python port](https://pypi.org/project/asciichartpy) included!\n- Java: [ASCIIGraph](https://github.com/MitchTalmadge/ASCIIGraph), ported by [MitchTalmadge](https://github.com/MitchTalmadge). If you're a Java-person, check it out!\n- Go: [asciigraph](https://github.com/guptarohit/asciigraph), ported by [guptarohit](https://github.com/guptarohit), Go people! )\n- Haskell: [asciichart](https://github.com/madnight/asciichart), ported by [madnight](https://github.com/madnight) to Haskell world!\n- Ruby: [ascii_chart](https://github.com/zhustec/ascii_chart), ported by [zhustec](https://github.com/zhustec)!\n- Elixir: [asciichart](https://github.com/sndnv/asciichart), ported by [sndv](https://github.com/sndnv)!\n- Perl: [App::AsciiChart](https://github.com/vti/app-asciichart), ported by [vti](https://github.com/vti)!\n- C: [plot](https://github.com/annacrombie/plot), ported by [annacrombie](https://github.com/annacrombie)!\n- C++: [asciichart](https://github.com/Civitasv/asciichart), ported by [Civitasv](https://github.com/Civitasv)!\n- R: [asciichartr](https://github.com/blmayer/asciichartr), ported by [blmayer](https://github.com/blmayer)!\n- Rust: [rasciigraph](https://github.com/orhanbalci/rasciigraph), ported by [orhanbalci](https://github.com/orhanbalci)!\n- PHP: [PHP-colored-ascii-linechart](https://github.com/noximo/PHP-colored-ascii-linechart), ported by [noximo](https://github.com/noximo)!\n- C#: [asciichart-sharp](https://github.com/NathanBaulch/asciichart-sharp), ported by [samcarton](https://github.com/samcarton), maintained by [NathanBaulch](https://github.com/NathanBaulch)!\n- Deno: [chart](https://github.com/maximousblk/chart), ported by [maximousblk](https://github.com/maximousblk)!\n- Lua: [lua-asciichart](https://github.com/wuyudi/lua-asciichart), ported by [wuyudi](https://github.com/wuyudi)!\n- Dart: [ascii_chart](https://github.com/rave98/ascii_chart), ported by [Rave98](https://github.com/rave98)\n\n### Future work (coming soon, hopefully)\n\n- levels and points on the graph!\n- even better value formatting and auto-scaling!\n\n![preview](https://user-images.githubusercontent.com/1294454/31798504-ca2af4cc-b53c-11e7-946c-620d744f6d16.gif)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkroitor%2Fasciichart","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkroitor%2Fasciichart","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkroitor%2Fasciichart/lists"}