{"id":19824583,"url":"https://github.com/jaredk3nt/string-graph","last_synced_at":"2026-05-14T19:34:25.540Z","repository":{"id":36474964,"uuid":"227402096","full_name":"Jaredk3nt/string-graph","owner":"Jaredk3nt","description":"Create graphs as strings for use in the command line and text documents","archived":false,"fork":false,"pushed_at":"2022-02-12T20:24:36.000Z","size":487,"stargazers_count":0,"open_issues_count":10,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-11T16:35:03.199Z","etag":null,"topics":["command-line","graph","graphing","text"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Jaredk3nt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-12-11T15:46:57.000Z","updated_at":"2020-02-10T16:45:25.000Z","dependencies_parsed_at":"2022-08-08T15:01:34.599Z","dependency_job_id":null,"html_url":"https://github.com/Jaredk3nt/string-graph","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jaredk3nt%2Fstring-graph","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jaredk3nt%2Fstring-graph/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jaredk3nt%2Fstring-graph/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jaredk3nt%2Fstring-graph/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Jaredk3nt","download_url":"https://codeload.github.com/Jaredk3nt/string-graph/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241181128,"owners_count":19923368,"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":["command-line","graph","graphing","text"],"created_at":"2024-11-12T11:04:54.079Z","updated_at":"2025-11-22T19:03:40.104Z","avatar_url":"https://github.com/Jaredk3nt.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# String Graph\n\nCreate simple graphs in strings for use in the command line or text documents!\n\n## Bar Graph\n\nString graph exports a `barGraph` function for generating bar graphs from an array of numbers.\n\n### Example\n\n```js\nconst { barGraph } = require(\"string-graph\");\n\nconst graph = barGraph([5, 10, 15], {\n  yLabels: true,\n  yLabelCount: 3\n});\n\n/* Output\n15     ■\n       ■\n       ■\n       ■\n       ■\n10   ■ ■\n     ■ ■\n     ■ ■\n     ■ ■\n     ■ ■\n 5 ■ ■ ■\n   ■ ■ ■\n   ■ ■ ■\n   ■ ■ ■\n   ■ ■ ■\n*/\n```\n\n### Usage\n\nThe `barGraph` accepts two arguments.\n\nThe first argument is an array of data to be displayed in the graph. Items of this array can either be numbers or objects. The object form is required to support a `data` field with the number value of the data point, it can also accept a `label` field to add a label to the x-axis under the data bar.\n\nThe second argument is the options object that is used to cusomize the appearance of the graph. The following fields are supported for this graph:\n\n| Name            | Type    | Description                                                                                                                                                                                | Default                                                   |\n| --------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------- |\n| `height`        | number  | Describes the max character height of the graph                                                                                                                                            | The maximum value in your data or `50` whichever is lower |\n| `token`         | string  | The character to be used to show data in the graph                                                                                                                                         | `■`                                                       |\n| `lineEnding`    | string  | The string to place at each line break to support multiple systems                                                                                                                         | `\"\\n\"`                                                    |\n| `columnWidth`   | number  | The number of characters wide each bar in the graph should be                                                                                                                              | `1`                                                       |\n| `columnSpacing` | number  | The number of characters used between each bar in the graph                                                                                                                                | `1`                                                       |\n| `yLabels`       | boolean | Whether or not to show y-axis labels                                                                                                                                                       | `false`                                                   |\n| `yLabelCount`   | number  | How many y-axis labels to show on the graph. If this number and the height are not divisible it will round and may not be exact.                                                           | `5`                                                       |\n| `unit`          | string  | A unit to display next to the y-axis labels                                                                                                                                                | `''`                                                      |\n| `xLabelWidth`   | number  | The character width allowed for the x-axis labels, labels longer than this width will wrap to the next line. This will add spacing to the bars in addition to the existing `columnSpacing` | `5`                                                       |\n\n## Scatter Plot (beta)\n\nString graph exports a `scatterPlot` function for generating scatter plots from an array of points (x/y number tuples).\n\n### Example\n\n```js\nconst { barGraph } = require(\"string-graph\");\n\nconst graph = scatterPlot([\n    [200, 12],\n    [201, 15],\n    [201, 14],\n    [202, 14],\n    [208, 13]\n  ], {\n    yLabels: true,\n    yLabelCount: 4,\n    xLabels: true,\n    xLabelCount: 5,\n    guides: false\n  })\n\n/* Output\n15 ┤    +\n14 ┤    +  +\n13 ┤                         +\n12 ┤ +\n    -┬--┬--┬--┬--┬--┬--┬--┬--┬-\n     200   202   204   206   208\n*/\n```\n\n### Usage\n\nThe `scatterPlot` function accepts two arguments.\n\nThe first argument is an array of data to be displayed in the graph. Items of this array can either be arrays or objects. The object form requires an explicit `x` and `y` parameter, whereas the array form assumes the first element is the `x` value and the second is the `y` value.\n\nThe second argument is the options object that is used to cusomize the appearance of the graph. The following fields are supported for this graph:\n\n| Name            | Type    | Description                                                                                                                                                                                | Default                                                   |\n| --------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------- |\n| `token`         | string  | The character to be used to show data in the graph                                                                                                                                         | `+`                                                       |\n| `lineEnding`    | string  | The string to place at each line break to support multiple systems                                                                                                                         | `\"\\n\"`                                                    |\n| `yLabels`       | boolean | Whether or not to show y-axis labels                                                                                                                                                       | `false`                                                   |\n| `xLabels`       | boolean | Whether or not to show x-axis labels                                                                                                                                                       | `false`                                                   |\n| `yLabelCount`   | number  | How many y-axis labels to show on the graph. If this number and the height are not divisible it will round and may not be exact.                                                           | `5`                                                       |\n| `xLabelCount`   | number  | How many x-axis labels to show on the graph. If this number and the height are not divisible it will round and may not be exact.                                                           | `5`                                                       |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaredk3nt%2Fstring-graph","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaredk3nt%2Fstring-graph","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaredk3nt%2Fstring-graph/lists"}