chartsplat-cli
v1.0.0
Published
Command-line interface for Chart Splat - generate charts from your terminal
Maintainers
Readme
chartsplat-cli
Command-line interface for Chart Splat. Generate beautiful charts from your terminal.
Installation
npm install -g chartsplat-cliOr use with npx (no installation required):
npx chartsplat-cli bar --labels "Q1,Q2,Q3,Q4" --data "50,75,60,90" -o chart.pngQuick Start
Set your API key:
export CHARTSPLAT_API_KEY=your-api-key-hereGenerate a chart:
chartsplat bar --labels "Q1,Q2,Q3,Q4" --data "50,75,60,90" -o chart.pngCommands
Chart Types
Generate charts with a single command:
# Bar chart
chartsplat bar -l "Jan,Feb,Mar,Apr" -d "12,19,3,5" -o bar.png
# Line chart
chartsplat line -l "Mon,Tue,Wed,Thu,Fri" -d "5,9,3,7,2" -o line.png
# Pie chart
chartsplat pie -l "Red,Blue,Green" -d "30,50,20" -o pie.png
# Doughnut chart
chartsplat doughnut -l "A,B,C,D" -d "25,35,20,20" -o doughnut.png
# Radar chart
chartsplat radar -l "Speed,Power,Defense,Agility,Stamina" -d "80,65,90,70,85" -o radar.png
# Polar area chart
chartsplat polararea -l "North,South,East,West" -d "40,30,20,10" -o polar.pngOptions
| Option | Short | Description |
|--------|-------|-------------|
| --labels | -l | Comma-separated labels (e.g., "Q1,Q2,Q3,Q4") |
| --data | -d | Comma-separated values (e.g., "50,75,60,90") |
| --config | | JSON config file (alternative to --labels and --data) |
| --title | -t | Chart title |
| --label | | Dataset label (for legend) |
| --color | -c | Background color (hex, e.g., "#8b5cf6") |
| --width | -w | Image width in pixels (default: 800) |
| --height | | Image height in pixels (default: 600) |
| --output | -o | Output file path (default: "chart.png") |
| --api-key | | API key (or set CHARTSPLAT_API_KEY env var) |
Using Config Files
Create a config file for complex charts:
chartsplat init -o my-chart.jsonEdit my-chart.json:
{
"type": "bar",
"data": {
"labels": ["Q1", "Q2", "Q3", "Q4"],
"datasets": [
{
"label": "Revenue",
"data": [50, 75, 60, 90],
"backgroundColor": "#8b5cf6"
},
{
"label": "Expenses",
"data": [30, 40, 35, 50],
"backgroundColor": "#ef4444"
}
]
},
"options": {
"width": 1000,
"height": 600,
"plugins": {
"title": {
"display": true,
"text": "Quarterly Financials"
}
}
}
}Generate from config:
chartsplat bar --config my-chart.json -o financials.pngInfo
Show current configuration:
chartsplat infoEnvironment Variables
| Variable | Description |
|----------|-------------|
| CHARTSPLAT_API_KEY | Your Chart Splat API key |
| CHARTSPLAT_API_URL | API base URL (default: https://api.chartsplat.com) |
Examples
Multiple Datasets
Use a config file for multiple datasets:
{
"data": {
"labels": ["Jan", "Feb", "Mar", "Apr"],
"datasets": [
{ "label": "2024", "data": [10, 15, 12, 18], "backgroundColor": "#3b82f6" },
{ "label": "2025", "data": [12, 18, 15, 22], "backgroundColor": "#10b981" }
]
}
}Styled Line Chart
chartsplat line \
-l "Mon,Tue,Wed,Thu,Fri,Sat,Sun" \
-d "5,9,3,7,2,8,6" \
--title "Weekly Traffic" \
--color "#3b82f6" \
-w 1200 --height 400 \
-o traffic.pngLicense
MIT
