{"id":13431326,"url":"https://github.com/FormidableLabs/victory-cli","last_synced_at":"2025-03-16T11:31:27.652Z","repository":{"id":45097330,"uuid":"66851537","full_name":"FormidableLabs/victory-cli","owner":"FormidableLabs","description":"A tool for generating charts on the command line.","archived":true,"fork":false,"pushed_at":"2022-02-18T22:39:48.000Z","size":210,"stargazers_count":312,"open_issues_count":6,"forks_count":8,"subscribers_count":52,"default_branch":"master","last_synced_at":"2025-03-12T21:03:20.562Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/FormidableLabs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-08-29T14:33:56.000Z","updated_at":"2024-12-18T12:00:59.000Z","dependencies_parsed_at":"2022-09-06T03:00:46.894Z","dependency_job_id":null,"html_url":"https://github.com/FormidableLabs/victory-cli","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FormidableLabs%2Fvictory-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FormidableLabs%2Fvictory-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FormidableLabs%2Fvictory-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FormidableLabs%2Fvictory-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FormidableLabs","download_url":"https://codeload.github.com/FormidableLabs/victory-cli/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243862894,"owners_count":20360235,"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":[],"created_at":"2024-07-31T02:01:02.255Z","updated_at":"2025-03-16T11:31:27.015Z","avatar_url":"https://github.com/FormidableLabs.png","language":"JavaScript","readme":"\u003ch1 align=\"center\"\u003evictory-cli\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca title='Build Status' href=\"https://raw.githubusercontent.com/FormidableLabs/babel-plugin-transform-define/master/LICENSE\"\u003e\n    \u003cimg src='https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square' /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://badge.fury.io/js/victory-cli\"\u003e\n    \u003cimg src=\"https://badge.fury.io/js/victory-cli.svg\" alt=\"npm version\" height=\"18\"\u003e\n  \u003c/a\u003e\n  \u003ca href='http://travis-ci.org/FormidableLabs/victory-cli'\u003e\n    \u003cimg src='https://secure.travis-ci.org/FormidableLabs/victory-cli.svg?branch=master' /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/FormidableLabs/victory-cli#maintenance-status\"\u003e\n    \u003cimg alt=\"Maintenance Status\" src=\"https://img.shields.io/badge/maintenance-experimental-purple.svg\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003ch4 align=\"center\"\u003e\n  A tool for generating \u003ca href=\"https://github.com/FormidableLabs/victory/\"\u003eVictory\u003c/a\u003e component image charts on the command line.\n\u003c/h4\u003e\n\n---\n\n## Installation\n\nFirst, install `librsvg`, which is a dependency for this library to work. **THIS IS IMPORTANT**:\n\nIf you do not install `librsvg` first, the global install _will blow up_.\n\n#### Ubuntu:\n\n```bash\nsudo apt-get install librsvg2-dev\n```\n\n#### RedHat / OpenSUSE:\n\n```bash\nsudo yum install librsvg2-devel\n```\n\n#### Mac OS X:\n\n```bash\nbrew install librsvg\n```\n\nIf, after installing LibRSVG through homebrew you are experiencing issues installing this module,\ntry manually exporting the package config with this command:\n\n```bash\nexport PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig\n```\n\nThen, install this module.\n\n```sh\nnpm install -g victory-cli\n```\n\nFor further information, [see this thread](https://github.com/Homebrew/homebrew/issues/14123).\n\n#### Windows:\n\nYou will need cairo and librsvg-2 libraries which is bundled in GTK. Go to http://www.gtk.org/download/win64.php\n(or http://www.gtk.org/download/win32.php for 32-bit node) and download the all-in-one bundle (these instructions\nused the following zip http://win32builder.gnome.org/gtk+-bundle_3.6.4-20131201_win64.zip). Unzip the contents\nin C:\\GTK (if you want to change this you must define `-GTK_Root=c:\\another\\path` shell variable to npm or node-gyp\nto reflect your changes), and add `\"C:\\GTK\\bin;\"` to the PATH environment variable in Windows, it's necessary for\nnode-rsvg runtime to load those libs.\n\n## Usage\n\nOnce installed, you can now run `victory-cli` from the command line. Check out the usage info below to\nsee some of the cool things you can do:\n\n```sh\nUsage: victory-cli [data] [script] [options]\n\n  Options:\n\n    -h, --help                   output usage information\n    -V, --version                output the version number\n    -c, --charttype [charttype]  'area', 'bar', 'line', 'scatter' or 'pie' (default: line)\n    -f, --format [format]        'png' or 'svg' (default: png)\n    -p, --print                  Prints chart to console (iTerm3 \u0026 .png format only!) (default: false)\n    -h, --h [h]                  Chart height (default: 500)\n    -w, --w [w]                  Chart width (default: 500)\n    -x, --x [x]                  Data x value (default: null)\n    -y, --y [y]                  Data y value (default: null)\n    -t, --theme [theme]          'light', 'dark' or 'hacker' (default: hacker)\n```\n\n### Basic Example\n\nSo, like [Victory](https://github.com/FormidableLabs/victory/), `victory-cli` comes with some sensible defaults.\nTo render a default line chart to a png, you would run:\n\n```sh\nvictory-cli -c line \u003e test.png\n```\n\nIf you instead wanted an svg file, you could run:\n\n```sh\nvictory-cli -c line -f svg \u003e test.svg\n```\n\nYou can also use the `-c` flag to select any of our preset charts, detailed in the usage doc above.\n\n### Images in the Term\n\nGenerating images is cool, but displaying charts in the terminal is even cooler! By default `victory-cli` writes\nto `stdout`, so you can do things like piping and file output, but you can override this with the `-p` or `--print` flag.\n\n\u003e Note: This only works on iTerm 3. It should work in HyperChart soon.\n\n```sh\nvictory-cli -c line --print\n```\n\n💥 Boom:\n\n![http://i.imgur.com/ZF3e5lh.png](http://i.imgur.com/ZF3e5lh.png)\n\n### Theming\n\nOut of the box we support a light, dark and hacker (green) theme for your charts. Simply set the `-t` flag\nto have the theme applied:\n\n```sh\nvictory-cli -c area -t light --print\n```\n\n### Custom Data\n\nSo you brought your own data did ya? Thats cool, its the first argument of this bin. You can pass your\nown data in like this:\n\n```sh\nvictory-cli data/data.json --print\n```\n\nWe expect the data to be in a regular chart data format like:\n\n```json\n{\n  \"data\": [{ \"x\": 0, \"y\": 15 }]\n}\n```\n\nLets say it isn't though. Thats cool, if its close enough you can use the x and y flags to select your\nfield names. So if your data looks like this:\n\n```json\n{\n  \"data\": [{ \"foo\": 0, \"bar\": 15 }]\n}\n```\n\nIt can still work by running:\n\n```sh\nvictory-cli data/data.json -x foo -y bar --print\n```\n\nIf your data is too different from what we accept, check out how to do a custom component script below.\n\n### Custom Component Scripts\n\nOk. You want to get serious here about your customization. We have you covered. The second argument for\nthis bin is a custom script where you can define the component that gets rendered. All you have to do is\ncreate a file that returns a function that we can pass data and options to, and that returns a React component\nthat renders a valid SVG.\n\nCheck this example out:\n\n```js\n// script.js\n\nconst React = require(\"react\");\nconst Victory = require(\"victory\");\n\nconst { VictoryChart, VictoryLine, VictoryTheme, VictoryScatter } = Victory;\n\nmodule.exports = function wrapperComponent(data, options) {\n  class VictoryWrapper extends React.Component {\n    render() {\n      return (\n        \u003cVictoryChart\n          height={options.height}\n          width={options.width}\n          theme={VictoryTheme.material}\n        \u003e\n          \u003cVictoryLine\n            data={data}\n            style={{\n              data: {\n                stroke: \"#3498db\",\n              },\n            }}\n          /\u003e\n          \u003cVictoryScatter\n            data={data}\n            style={{\n              data: {\n                fill: \"#e74c3c\",\n              },\n            }}\n          /\u003e\n        \u003c/VictoryChart\u003e\n      );\n    }\n  }\n\n  return VictoryWrapper;\n};\n```\n\nAfter you've created this file, simply run it like this:\n\n```sh\nvictory-cli data.json script.js --print\n```\n\n💥 And it's custom chart city:\n\n![http://i.imgur.com/VyB4eqa.png](http://i.imgur.com/VyB4eqa.png)\n\n## Credits\n\nThis project was HEAVILY inspired by Matthew Conlens work on [https://github.com/mathisonian/hyperchart](https://github.com/mathisonian/hyperchart)\n\n## _IMPORTANT_\n\nThis project is in a pre-release state. We're hard at work fixing bugs and improving the API. Be prepared for breaking changes!\n\n\n## Maintenance Status\n\n**Archived:** This project is no longer maintained by Formidable. We are no longer responding to issues or pull requests unless they relate to security concerns. We encourage interested developers to fork this project and make it their own!\n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FFormidableLabs%2Fvictory-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FFormidableLabs%2Fvictory-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FFormidableLabs%2Fvictory-cli/lists"}