{"id":20571820,"url":"https://github.com/usrme/gobarchar","last_synced_at":"2026-02-11T16:37:06.363Z","repository":{"id":215502745,"uuid":"738645255","full_name":"usrme/gobarchar","owner":"usrme","description":"The charting solution that might not suit you 📊","archived":false,"fork":false,"pushed_at":"2024-12-14T09:24:40.000Z","size":155,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-14T17:07:26.410Z","etag":null,"topics":["bar-chart","chart","go","golang","graph"],"latest_commit_sha":null,"homepage":"https://gobarchar.usrme.xyz/","language":"Go","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/usrme.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2024-01-03T17:53:34.000Z","updated_at":"2024-12-14T09:24:44.000Z","dependencies_parsed_at":"2024-01-04T20:27:55.283Z","dependency_job_id":"806d4f22-3461-4e26-a91c-9f4a6d0d0025","html_url":"https://github.com/usrme/gobarchar","commit_stats":null,"previous_names":["usrme/gobarchar"],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usrme%2Fgobarchar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usrme%2Fgobarchar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usrme%2Fgobarchar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usrme%2Fgobarchar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/usrme","download_url":"https://codeload.github.com/usrme/gobarchar/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248923765,"owners_count":21183953,"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":["bar-chart","chart","go","golang","graph"],"created_at":"2024-11-16T05:17:23.854Z","updated_at":"2026-02-11T16:37:01.344Z","avatar_url":"https://github.com/usrme.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gobarchar\n\n![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/usrme/gobarchar)\n[![test](https://github.com/usrme/gobarchar/actions/workflows/test.yml/badge.svg)](https://github.com/usrme/gobarchar/actions/workflows/test.yml)\n[![Go Report Card](https://goreportcard.com/badge/github.com/usrme/gobarchar)](https://goreportcard.com/report/github.com/usrme/gobarchar)\n\nFor whatever reason, I was enamored with [Alex Chan's snippet of code](https://alexwlchan.net/2018/ascii-bar-charts/) where a key-value pair list is turned into a passable bar chart for quick demonstration purposes. When writing a [blog post mentioning the number of books I've read](https://usrme.xyz/posts/glee-in-2023/#books-read) I wanted to quickly visualize the values, but didn't want to spend too much time on it. The solution above worked wonders! But I wanted the same thing without having to actually open a terminal (heresy, I know), thus this thing was born: the charting solution that might not suit you 📊\n\n![GoBarChar - animated GIF demo](examples/demo.gif)\n\nTry the same link as in the demo above, https://gobarchar.usrme.xyz/?2012=8\u00262013=6\u00262014=8\u00262015=14, or just load the site without any parameters to get random data.\n\n## Features\n\n- Send data and get chart back\n- Perform calculation for average to the nearest integer\n- Perform calculation for sum of all values\n- Sort ascending or descending, or don't sort at all\n  - Add the `sort` query parameter and pass either `asc` or `desc` as the value\n  - The default is to keep the rows ordered as the query parameters are\n- Replace `%20` HTML entity with a space\n  - Add the `spaces` query parameter and pass `yes` as the value\n    - Any other value will be disregarded\n  - The default is to not do any replacing\n- Display a custom title for the chart to make sharing charts better\n  - Add the `title` query parameter and any value you want\n    - For `curl` requests the value needs to be HTML encoded\n      - Something like the following could be used to automate this: `curl \"http://localhost:8080/?February=5\u0026March=20\u0026title=$(echo 'Title with spaces in it' | python3 -c 'import urllib.parse,sys; print(urllib.parse.quote(sys.stdin.read().strip()))')\"`\n      - Alternatively, after rendering the chart with the title in the browser, just copy the generated link from the page\n\n## Usage\n\n### On the Fly\n\n(Excuse the pun). Instead of installing the thing, you can also access the same functionality using the instance hosted on [Fly](https://fly.io/) at https://gobarchar.usrme.xyz/:\n\n```console\n$ curl https://gobarchar.usrme.xyz/\nApril        7 █▊\nFebruary    88 ██████████████████████▏\nJune        16 ████\nMarch       99 █████████████████████████\nOctober     19 ████▊\nSeptember   98 ████████████████████████▋\nAvg.        55 █████████████▉\nTotal      327 █████████████████████████\n```\n\nLoading the page without any query parameters randomly chooses some data and will do so upon every reload; a link will be presented at the bottom to link to the data. The site should always be available for usage, but if it's not then do open up an issue and I'll see what I can do.\n\n### Local\n\nAfter [installation](#installation), execute `gobarchar`, which by default starts a web server listening on port 8080, though you can specify a different port through the `PORT` environment variable. Once the web server is running, you can use something like `curl` to perform requests:\n\n```console\n$ gobarchar \u0026\n[1] 32357\n2024/07/26 12:23:13 listening on: 8080\n$ curl localhost:8080\n2024/07/26 12:23:16 completed in: 87.958µs\nAugust        32 ████████████████\nFebruary      50 █████████████████████████\nJuly           7 ███▌\nMarch          6 ███\nNovember      44 ██████████████████████\nSeptember      8 ████\nAvg.       24.50 ████████████▎\nTotal        147 █████████████████████████\n```\n\nIf no query parameters are provided then random data is generated. The \"completed in\" log line isn't a part of the chart output, but rather the result of using [job control](https://jvns.ca/blog/2024/07/03/reasons-to-use-job-control/) and having the standard output of a background process being interleaved with the standard output of a foreground process.\n\n## Installation\n\n- using `go install`:\n\n```bash\ngo install github.com/usrme/gobarchar/cmd/...@latest\n```\n\n- download a binary from the [releases](https://github.com/usrme/gobarchar/releases) page\n\n- build it yourself (requires Go 1.17+):\n\n```bash\ngit clone https://github.com/usrme/gobarchar.git\ncd gobarchar\ngo build -o gobarchar cmd/gobarchar/main.go\n```\n\n## Removal\n\n```bash\nrm -f \"${GOPATH}/bin/gobarchar\"\nrm -rf \"${GOPATH}/pkg/mod/github.com/usrme/gobarchar*\"\n```\n\n## Acknowledgments\n\nHeavily inspired by the ['Drawing ASCII bar charts' blog post](https://alexwlchan.net/2018/ascii-bar-charts/) by Alex Chan. If there was any prior art that pretty much does the same thing (present an ASCII chart based on query parameters or request payload), then I honestly wasn't aware of it and just created this for fun.\n\n## License\n\n[MIT](/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fusrme%2Fgobarchar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fusrme%2Fgobarchar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fusrme%2Fgobarchar/lists"}