[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-3504":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":14,"stars7d":16,"stars30d":17,"stars90d":15,"forks30d":15,"starsTrendScore":16,"compositeScore":18,"rankGlobal":10,"rankLanguage":10,"license":19,"archived":20,"fork":20,"defaultBranch":21,"hasWiki":22,"hasPages":20,"topics":23,"createdAt":10,"pushedAt":10,"updatedAt":29,"readmeContent":30,"aiSummary":31,"trendingCount":15,"starSnapshotCount":15,"syncStatus":32,"lastSyncTime":33,"discoverSource":34},3504,"asciigraph-rs","neneodonkor\u002Fasciigraph-rs","neneodonkor","Rust Library to make lightweight ASCII line graph ╭┈╯ in command line apps.","",null,"Rust",139,5,1,0,3,11,46.93,"BSD 3-Clause \"New\" or \"Revised\" License",false,"master",true,[24,25,26,27,28],"ascii","cli","rust","rust-lang","rust-library","2026-06-12 04:00:18","# Rust Port of asciigraph\n\n[![Crates.io](https:\u002F\u002Fimg.shields.io\u002Fcrates\u002Fv\u002Fasciigraph-rs.svg)](https:\u002F\u002Fcrates.io\u002Fcrates\u002Fasciigraph-rs)\n[![Docs.rs](https:\u002F\u002Fdocs.rs\u002Fasciigraph-rs\u002Fbadge.svg)](https:\u002F\u002Fdocs.rs\u002Fasciigraph-rs)\n[![License](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Flicense-BSD--3--Clause-blue.svg)](LICENSE)\n\nRust library to make lightweight ASCII line graphs ╭┈╯ in command line apps. \n\nThis repo started as a complete and faithful implementation of the Go version of asciigraph \n(version 0.9.0) [guptarohit\u002Fasciigraph](https:\u002F\u002Fgithub.com\u002Fguptarohit\u002Fasciigraph), supporting:\n\n- Single and multi-series plots\n- ANSI color support for series, axes, labels, and captions\n- Series legends\n- X-axis with configurable tick labels\n- Custom character sets for plot lines\n- Y-axis and X-axis value formatters\n- NaN gap handling with proper start and end caps\n- Lower and upper bound constraints\n- Configurable precision for Y-axis labels\n- Line ending configuration (CRLF support)\n- A full CLI binary with realtime streaming support and configurable FPS\n\nFull API documentation is available on [docs.rs](https:\u002F\u002Fdocs.rs\u002Fasciigraph-rs).\n[Changelog](CHANGELOG.md)\n\n## Installation\n\nRun the following command in your project directory:\n\n```bash\ncargo add asciigraph-rs\n```\n\nOr manually add this to your `Cargo.toml`:\n\n```toml\n[dependencies]\nasciigraph-rs = \"0.1.5\"\n```\n\n## Usage\n\n### Basic graph\n\n```rust\nuse asciigraph::{plot, Config};\n\nfn main() {\n    let data = vec![3.0, 4.0, 9.0, 6.0, 2.0, 4.0, 5.0, 8.0, 5.0, 10.0, 2.0, 7.0, 2.0, 5.0, 6.0];\n    let graph = plot(&data, Config::default());\n    println!(\"{}\", graph);\n}\n```\n\nRunning this example would render the following graph:\n```\n  10.00 ┤        ╭╮\n   9.00 ┤ ╭╮     ││\n   8.00 ┤ ││   ╭╮││\n   7.00 ┤ ││   ││││╭╮\n   6.00 ┤ │╰╮  ││││││ ╭\n   5.00 ┤ │ │ ╭╯╰╯│││╭╯\n   4.00 ┤╭╯ │╭╯   ││││\n   3.00 ┼╯  ││    ││││\n   2.00 ┤   ╰╯    ╰╯╰╯\n```\n\n### Multiple Series\n\n```rust\nuse asciigraph::{plot_many, Config};\n\nfn main() {\n    let s1 = vec![0.0, 1.0, 2.0, 3.0, 3.0, 3.0, 2.0, 0.0];\n    let s2 = vec![5.0, 4.0, 2.0, 1.0, 4.0, 6.0, 6.0];\n    let data: Vec\u003C&[f64]> = vec![&s1, &s2];\n\n    let graph = plot_many(&data, Config::default());\n    println!(\"{}\", graph);\n}\n```\n\nRunning this example would render the following graph:\n```\n 6.00 ┤    ╭─\n 5.00 ┼╮   │\n 4.00 ┤╰╮ ╭╯\n 3.00 ┤ │╭│─╮\n 2.00 ┤ ╰╮│ ╰╮\n 1.00 ┤╭╯╰╯  │\n 0.00 ┼╯     ╰\n```\n\n### Custom Y-axis value formatting\n\nUse `.y_axis_value_formatter(...)` to control how values printed on the Y-axis are rendered.\nThis is useful for human-readable units like bytes, durations, or domain-specific labels.\n\n```rust\nuse asciigraph::{plot, Config};\n\nfn main() {\n    let data = vec![\n        30.0 * 1024.0 * 1024.0 * 1024.0,\n        70.0 * 1024.0 * 1024.0 * 1024.0,\n        2.0 * 1024.0 * 1024.0 * 1024.0,\n    ];\n\n    let graph = plot(\n        &data,\n        Config::default()\n            .height(5)\n            .width(45)\n            .y_axis_value_formatter(Box::new(|v: f64| {\n                format!(\"{:.2} GiB\", v \u002F 1024.0 \u002F 1024.0 \u002F 1024.0)\n            })),\n    );\n\n    println!(\"{}\", graph);\n}\n```\n\nRunning this example would render the following graph:\n```\n 70.00 GiB ┤                 ╭──────╮\n 56.40 GiB ┤         ╭───────╯      ╰────╮\n 42.80 GiB ┤  ╭──────╯                   ╰───╮\n 29.20 GiB ┼──╯                              ╰────╮\n 15.60 GiB ┤                                      ╰───╮\n  2.00 GiB ┤                                          ╰─\n```\n### X-axis support\n\nUse `.x_axis_range(min, max)` to add a labeled X-axis below the graph. `.x_axis_tick_count(n)` controls how many tick marks appear (default 5, minimum 2).\n\n```rust\nuse asciigraph::{plot, Config};\n\nfn main() {\n    let data = vec![3.0, 4.0, 9.0, 6.0, 2.0, 4.0, 5.0, 8.0, 5.0, 10.0, 2.0, 7.0, 2.0, 5.0, 6.0];\n\n    let graph = plot(\n        &data,\n        Config::default()\n            .x_axis_range(0.0, 14.0)\n            .x_axis_tick_count(3),\n    );\n\n    println!(\"{}\", graph);\n}\n```\n\nRunning this example would render the following graph:\n\n```\n 10.00 ┤        ╭╮\n  9.00 ┤ ╭╮     ││\n  8.00 ┤ ││   ╭╮││\n  7.00 ┤ ││   ││││╭╮\n  6.00 ┤ │╰╮  ││││││ ╭\n  5.00 ┤ │ │ ╭╯╰╯│││╭╯\n  4.00 ┤╭╯ │╭╯   ││││\n  3.00 ┼╯  ││    ││││\n  2.00 ┤   ╰╯    ╰╯╰╯\n       └┬──────┬──────┬\n        0      7     14\n```\n\n### Colored graphs\n\nUse `.series_colors(...)` to assign ANSI colors to each series.\n\n```rust\nuse asciigraph::{plot_many, Config, AnsiColor};\n\nfn main() {\n    let data: Vec\u003CVec\u003Cf64>> = (0..4)\n        .map(|i| {\n            (-20..=20)\n                .map(|x| {\n                    let r = 20 - i;\n                    if x >= -r && x \u003C= r {\n                        let r = r as f64;\n                        let x = x as f64;\n                        (r * r - x * x).sqrt() \u002F 2.0\n                    } else {\n                        f64::NAN\n                    }\n                })\n                .collect()\n        })\n        .collect();\n\n    let refs: Vec\u003C&[f64]> = data.iter().map(|s| s.as_slice()).collect();\n\n    let graph = plot_many(\n        &refs,\n        Config::default()\n            .precision(0)\n            .series_colors(&[\n                AnsiColor::RED,\n                AnsiColor::YELLOW,\n                AnsiColor::GREEN,\n                AnsiColor::BLUE,\n            ]),\n    );\n\n    println!(\"{}\", graph);\n}\n```\n\n### Legends for colored graphs\n\nThe graph can include legends for each series, making it easier to interpret.\n\n```rust\nuse asciigraph::{plot_many, Config, AnsiColor};\n\nfn main() {\n    let data: Vec\u003CVec\u003Cf64>> = (0..3)\n        .map(|i| {\n            (-12..=12)\n                .map(|x| {\n                    let r = 12 - i;\n                    if x >= -r && x \u003C= r {\n                        let r = r as f64;\n                        let x = x as f64;\n                        (r * r - x * x).sqrt() \u002F 2.0\n                    } else {\n                        f64::NAN\n                    }\n                })\n                .collect()\n        })\n        .collect();\n\n    let refs: Vec\u003C&[f64]> = data.iter().map(|s| s.as_slice()).collect();\n\n    let graph = plot_many(\n        &refs,\n        Config::default()\n            .precision(0)\n            .series_colors(&[AnsiColor::RED, AnsiColor::GREEN, AnsiColor::BLUE])\n            .series_legends(&[\"Red\", \"Green\", \"Blue\"])\n            .caption(\"Series with legends\"),\n    );\n\n    println!(\"{}\", graph);\n}\n```\n\nFor a full list of features including zero-line highlighting, threshold lines,\nmoving average overlay, X-axis configuration, and many more features, see [FEATURES.md](FEATURES.md).\n\n## CLI Installation\n\nInstall the CLI binary with:\n\n```bash\ncargo install asciigraph-rs\n```\n\n## CLI Usage\n\n```\nasciigraph --help\n\nUsage: asciigraph [OPTIONS]\n\nOptions:\n  -h, --height \u003CHEIGHT>              height in text rows, 0 for auto-scaling [default: 0]\n  -w, --width \u003CWIDTH>                width in columns, 0 for auto-scaling [default: 0]\n  -o, --offset \u003COFFSET>              offset in columns, for the label [default: 3]\n  -p, --precision \u003CPRECISION>        precision of data point labels along the y-axis [default: 2]\n  -c, --caption \u003CCAPTION>            caption for the graph [default: ]\n  -r, --realtime                     enables realtime graph for data stream\n  -b, --buffer \u003CBUFFER>              data points buffer when realtime graph enabled [default: 0]\n  -f, --fps \u003CFPS>                    fps to control render frequency in realtime mode [default: 24]\n      --sc \u003CSERIES_COLORS>           comma-separated series colors [default: ]\n      --sl \u003CSERIES_LEGENDS>          comma-separated series legends [default: ]\n      --cc \u003CCAPTION_COLOR>           caption color of the plot [default: ]\n      --ac \u003CAXIS_COLOR>              y-axis color of the plot [default: ]\n      --lc \u003CLABEL_COLOR>             y-axis label color of the plot [default: ]\n      --lb \u003CLOWER_BOUND>             lower bound for the vertical axis [default: inf]\n      --ub \u003CUPPER_BOUND>             upper bound for the vertical axis [default: -inf]\n  -d, --delimiter \u003CDELIMITER>        data delimiter for splitting data points [default: ,]\n      --sn \u003CSERIES_NUM>              number of series (columns) in the input data [default: 1]\n  -x, --custom-char \u003CCUSTOM_CHAR>    character to use for plotting [default: ]\n      --xmin \u003CX_AXIS_MIN>            x-axis minimum value [default: NaN]\n      --xmax \u003CX_AXIS_MAX>            x-axis maximum value [default: NaN]\n      --xt \u003CX_AXIS_TICKS>            x-axis tick count [default: 5]\n      --help                         Print help\n```\n\nFeed data points via stdin:\n\n**Linux\u002FmacOS:**\n```bash\nseq 1 72 | asciigraph -h 10 -c \"plot data from stdin\" --xmin 0 --xmax 40 --xt 5\n```\n\n**Windows:**\n```powershell\n1..72 | ForEach-Object { $_ } | asciigraph -h 10 -c \"plot data from stdin\" --xmin 0 --xmax 40 --xt 5\n```\n\nOutput:\n\n```\n 72.00 ┤                                                                  ╭────\n 64.90 ┤                                                           ╭──────╯\n 57.80 ┤                                                    ╭──────╯\n 50.70 ┤                                             ╭──────╯\n 43.60 ┤                                      ╭──────╯\n 36.50 ┤                              ╭───────╯\n 29.40 ┤                       ╭──────╯\n 22.30 ┤                ╭──────╯\n 15.20 ┤         ╭──────╯\n  8.10 ┤  ╭──────╯\n  1.00 ┼──╯\n       └┬─────────────────┬─────────────────┬────────────────┬─────────────────┬\n        0                10                20               30                40\n                                  plot data from stdin\n```\n\n### Realtime graphs\n\nThe CLI supports streaming data in realtime using the `-r` flag.\nData is read line by line from stdin, and the graph re-renders\nat the specified FPS.\n\n**Linux\u002FmacOS:**\n```bash\nping google.com | grep -oP '(?\u003C=time=).*(?=ms)' --line-buffered | asciigraph -r -h 10 -w 40 -c \"ping (ms)\"\n```\n\n**Windows:**\n\nA built-in data generator (demo) is included for testing and demonstrating\nrealtime mode. Build and run it with:\n\n```powershell\ncargo build\n.\\target\\debug\\datagen.exe\n```\n\nThis generates random data and pipes it directly into `asciigraph`\nwith realtime rendering enabled. The generator bypasses Windows pipe\nbuffering by writing directly to the child process stdin, which is\nrequired for smooth realtime updates on Windows.\n\nFor your own data sources on Windows, pipe buffering can prevent\nrealtime updates from rendering correctly. The recommended approach\nis to write a small program in any language that flushes stdout\nexplicitly after each line, similar to how `datagen.rs` works.\n\n## Acknowledgement\n\nThis project is a Rust port of [guptarohit\u002Fasciigraph](https:\u002F\u002Fgithub.com\u002Fguptarohit\u002Fasciigraph), which itself started as a Go port of [kroitor\u002Fasciichart](https:\u002F\u002Fgithub.com\u002Fkroitor\u002Fasciichart).\n\n## Contributing\n\nFeel free to open issues or pull requests!\n\n## License\n\nBSD-3-Clause — see [LICENSE](LICENSE) for details.\n","asciigraph-rs 是一个用 Rust 语言编写的库，用于在命令行应用程序中生成轻量级的 ASCII 线图。该项目支持单系列和多系列图表绘制、ANSI 颜色配置、自定义字符集以及Y轴和X轴标签格式化等功能，还提供了完整的CLI二进制文件支持实时流媒体与可配置帧率。适合于需要在终端环境下直观展示数据趋势或比较不同数据集的应用场景，如系统监控工具、日志分析软件等。其简洁高效的API设计使得开发者能够轻松集成到自己的Rust项目中。",2,"2026-06-11 02:54:40","CREATED_QUERY"]