@neabyte/chart-to-image
Version:
Convert trading charts to images using Node.js canvas with advanced features: 6 chart types, VWAP/EMA/SMA indicators, custom colors, themes, hide elements, scaling, and PNG/JPEG export formats.
786 lines (598 loc) β’ 27 kB
Markdown
# π Usage Guide
Complete guide to using Chart-To-Image CLI and API with all features and examples.
## π Table of Contents
- [CLI Usage](#cli-usage)
- [Chart Types](#chart-types)
- [Technical Indicators](#technical-indicators)
- [Chart Comparison](#chart-comparison)
- [Timeframe Comparison](#timeframe-comparison)
- [Color Options](#color-options)
- [Hide Elements](#hide-elements)
- [Scaling Options](#scaling-options)
- [Exchange Support](#exchange-support)
- [Timeframes](#timeframes)
- [Output Formats](#output-formats)
- [Error Handling](#error-handling)
- [Advanced Examples](#advanced-examples)
## π» CLI Usage
### π§ Basic Commands
| Command | Description | Example |
|---------|-------------|---------|
| `--symbol, -s` | Trading symbol | `BTC/USDT`, `ETH/USDT` |
| `--timeframe, -t` | Chart timeframe | `1h`, `4h`, `1d` |
| `--exchange, -e` | Exchange name | `binance`, `kraken` |
| `--output, -o` | Output file path | `chart.png`, `output.jpg` |
| `--width, -w` | Chart width (px) | `800`, `1200`, `1600` |
| `--height, -h` | Chart height (px) | `600`, `800`, `1000` |
### π Chart Types
| Type | Description | Use Case |
|------|-------------|----------|
| `candlestick` | Traditional OHLC candles | Standard trading analysis |
| `line` | Simple line chart | Trend visualization |
| `area` | Filled area chart | Volume/price relationship |
| `heikin-ashi` | Trend-smoothed candles | Trend identification |
| `renko` | Price-based blocks | Noise filtering |
| `line-break` | Break high/low patterns | Trend continuation analysis |
### π Technical Indicators
| Indicator | Description | Use Case | CLI Flag |
|-----------|-------------|----------|----------|
| `VWAP` | Volume Weighted Average Price | Institutional analysis | `--vwap` |
| `EMA` | Exponential Moving Average | Trend analysis | `--ema` |
| `SMA` | Simple Moving Average | Trend analysis | `--sma` |
| `Bollinger Bands` | Volatility and trend analysis | Support/resistance levels | `--bb` |
| `Combined` | VWAP + EMA + SMA + BB together | Comprehensive analysis | `--vwap --ema --sma --bb` |
**VWAP Features:**
- Institutional standard calculation
- Volume-weighted price analysis
- Dashed line visualization
- Works on all chart types
**EMA Features:**
- Configurable periods (default: 20)
- Exponential smoothing
- Solid line visualization
- Customizable periods
**SMA Features:**
- Configurable periods (default: 20)
- Simple arithmetic average
- Teal line visualization
- Standard moving average calculation
**Bollinger Bands Features:**
- Configurable periods (default: 20)
- Configurable standard deviations (default: 2)
- Three bands: Upper (resistance), Middle (SMA), Lower (support)
- Custom colors for each band
- Background fill between bands with configurable opacity
- Works on all chart types (candlestick, line, area, heikin-ashi, renko)
- Dashed lines for upper/lower bands, solid line for middle band
- Support for comparison charts
**Combined Usage:**
```bash
# Single indicator
npx /chart-to-image -s BTC/USDT --vwap
npx /chart-to-image -s ETH/USDT --ema
npx /chart-to-image -s BTC/USDT --sma
# Multiple indicators together
npx /chart-to-image -s BTC/USDT --vwap --ema
npx /chart-to-image -s BTC/USDT --vwap --ema --sma
# Bollinger Bands
npx /chart-to-image -s BTC/USDT --bb
npx /chart-to-image -s ETH/USDT --bb --bb-period 20 --bb-standard-deviations 2
# Bollinger Bands with custom colors
npx /chart-to-image -s BTC/USDT --bb --bb-upper-color "#ff6b9d" --bb-middle-color "#4ecdc4" --bb-lower-color "#ff6b9d"
npx /chart-to-image -s ETH/USDT --bb --bb-background-color "#ff6b9d" --bb-background-opacity 0.2
# All indicators together
npx /chart-to-image -s BTC/USDT --vwap --ema --sma --bb
npx /chart-to-image -s ETH/USDT --vwap --ema --sma --bb --bb-upper-color "#ff6b9d" --bb-middle-color "#4ecdc4" --bb-lower-color "#ff6b9d" --bb-background-color "#ff6b9d" --bb-background-opacity 0.2
# In comparison charts
npx /chart-to-image --compare "BTC/USDT,ETH/USDT" --vwap --ema
npx /chart-to-image --compare "BTC/USDT,ETH/USDT" --vwap --ema --sma
npx /chart-to-image --compare "BTC/USDT,ETH/USDT" --bb
npx /chart-to-image --compare "BTC/USDT,ETH/USDT" --bb --bb-upper-color "#ff6b9d" --bb-middle-color "#4ecdc4" --bb-lower-color "#ff6b9d" --bb-background-color "#ff6b9d" --bb-background-opacity 0.2
```
### π Chart Comparison
| Feature | Description | Use Case |
|---------|-------------|----------|
| `--compare` | Compare multiple symbols | Market correlation analysis |
| `--layout` | Layout type (side-by-side, grid) | Different visualization styles |
| `--columns` | Grid columns (max 2) | Organized comparison layout |
| `--timeframes` | Compare timeframes | Multi-timeframe analysis |
### β° Timeframe Comparison
| Feature | Description | Use Case |
|---------|-------------|----------|
| `--timeframes` | Same symbol, different timeframes | Technical analysis |
| `--compare` | Symbol list (same symbol repeated) | Timeframe progression |
| All chart types | Apply to timeframe comparison | Specialized analysis |
### π¨ Themes & Colors
| Option | Format | Examples |
|--------|--------|----------|
| `--theme` | `light` \| `dark` | `--theme dark` |
| `--background-color` | Hex, RGB, Named, Gradient | `#1a1a2e`, `rgb(25,25,112)`, `midnightblue` |
| `--text-color` | Hex, RGB, Named | `#00d4ff`, `rgb(255,215,0)`, `gold` |
### π¨ Custom Bar Colors
| Color Type | Description | Default |
|------------|-------------|---------|
| `bullish` | Upward candle color | `#26a69a` |
| `bearish` | Downward candle color | `#ef5350` |
| `wick` | Candle wick color | `#424242` |
| `border` | Candle border color | `#E0E0E0` |
**Format**: `type=color,type=color`
**Example**: `--custom-colors "bullish=#00ff88,bearish=#ff4444,wick=#ffffff,border=#333333"`
### π Horizontal Levels
| Level Type | Description | Format |
|------------|-------------|--------|
| `value` | Price level | Number (e.g., 45000) |
| `color` | Line color | Hex, RGB, or named color |
| `style` | Line style | `solid` or `dotted` |
| `label` | Level label | Text (optional) |
**Format**: `value:color:style:label,value:color:style:label`
**Example**: `--levels "45000:#ff0000:solid:Resistance,40000:#00ff00:dotted:Support"`
### ποΈ Hide Elements
| Option | Description | Effect |
|--------|-------------|--------|
| `--hide-title` | Hide chart title | Removes title text |
| `--hide-time-axis` | Hide time labels | Removes X-axis labels |
| `--hide-grid` | Hide grid lines | Removes background grid |
### π Scaling Options
| Option | Description | Values |
|--------|-------------|--------|
| `--auto-scale` | Enable auto-scaling | Boolean |
| `--scale-x` | X-axis scale factor | `0.5` - `2.0` |
| `--scale-y` | Y-axis scale factor | `0.5` - `2.0` |
| `--min-scale` | Minimum price | Any number |
| `--max-scale` | Maximum price | Any number |
### π Data Options
| Option | Description | Default |
|--------|-------------|---------|
| `--fetch` | Fetch data only | `false` |
| `--limit` | Number of candles | `100` |
## π Chart Types
### π―οΈ Candlestick Charts
```bash
# Basic candlestick
npx /chart-to-image --symbol BTC/USDT --timeframe 1h --output candlestick.png
# Custom colors
npx /chart-to-image --symbol ETH/USDT --timeframe 4h --output custom-candlestick.png \
--custom-colors "bullish=#00ff88,bearish=#ff4444,wick=#ffffff,border=#333333"
```
### π Line Charts
```bash
# Simple line chart
npx /chart-to-image --symbol BTC/USDT --timeframe 1h --output line.png --chart-type line
# Custom theme
npx /chart-to-image --symbol ETH/USDT --timeframe 4h --output line-dark.png \
--chart-type line --theme dark --background-color "#1a1a2e"
```
### π Area Charts
```bash
# Area chart
npx /chart-to-image --symbol ADA/USDT --timeframe 1d --output area.png --chart-type area
# Light theme area
npx /chart-to-image --symbol BTC/USDT --timeframe 1h --output area-light.png \
--chart-type area --theme light
```
### π Heikin-Ashi Charts
```bash
# Heikin-Ashi for trend analysis
npx /chart-to-image --symbol ETH/USDT --timeframe 4h --output heikin-ashi.png \
--chart-type heikin-ashi
# Custom colors for Heikin-Ashi
npx /chart-to-image --symbol BTC/USDT --timeframe 1d --output ha-custom.png \
--chart-type heikin-ashi --custom-colors "bullish=#00d4aa,bearish=#ff6b6b"
```
### π§± Renko Charts
```bash
# Renko chart for noise filtering
npx /chart-to-image --symbol ETH/USDT --timeframe 1d --output renko.png \
--chart-type renko
# Renko with custom theme
npx /chart-to-image --symbol BTC/USDT --timeframe 1d --output renko-dark.png \
--chart-type renko --theme dark --background-color "#000000"
```
### π Chart Comparison
```bash
# Side-by-side symbol comparison
npx /chart-to-image --compare "BTC/USDT,ETH/USDT" --output comparison.png
# Grid comparison with custom colors
npx /chart-to-image --compare "BTC/USDT,ETH/USDT" --layout grid \
--custom-colors "bullish=#00ff88,bearish=#ff4444" --output grid-comparison.png
# Comparison with technical indicators
npx /chart-to-image --compare "BTC/USDT,ETH/USDT" --vwap --ema \
--output comparison-indicators.png
# Comparison with Bollinger Bands
npx /chart-to-image --compare "BTC/USDT,ETH/USDT" --bb --output comparison-bb.png
# Comparison with custom Bollinger Bands colors
npx /chart-to-image --compare "BTC/USDT,ETH/USDT" --bb \
--bb-upper-color "#ff6b9d" --bb-middle-color "#4ecdc4" --bb-lower-color "#ff6b9d" \
--bb-background-color "#ff6b9d" --bb-background-opacity 0.2 \
--output comparison-bb-custom.png
# Multiple symbols comparison
npx /chart-to-image --compare "BTC/USDT,ETH/USDT,ADA/USDT" --output multi-comparison.png
```
### β° Timeframe Comparison
```bash
# Same symbol, different timeframes
npx /chart-to-image --compare "BTC/USDT,BTC/USDT" --timeframes "1h,4h" \
--output timeframe-comparison.png
# Timeframe progression with indicators
npx /chart-to-image --compare "ETH/USDT,ETH/USDT,ETH/USDT,ETH/USDT" \
--timeframes "1m,5m,1h,1d" --vwap --ema --output eth-timeframes-indicators.png
# Heikin-Ashi timeframe comparison
npx /chart-to-image --compare "BTC/USDT,BTC/USDT" --timeframes "1h,4h" \
--chart-type heikin-ashi --output ha-timeframes.png
# Timeframe comparison with Bollinger Bands
npx /chart-to-image --compare "BTC/USDT,BTC/USDT" --timeframes "1h,4h" \
--bb --output timeframe-bb.png
# Timeframe comparison with custom Bollinger Bands
npx /chart-to-image --compare "ETH/USDT,ETH/USDT" --timeframes "1h,4h" \
--bb --bb-upper-color "#ff6b9d" --bb-middle-color "#4ecdc4" --bb-lower-color "#ff6b9d" \
--bb-background-color "#ff6b9d" --bb-background-opacity 0.2 \
--output timeframe-bb-custom.png
```
### π Bollinger Bands
```bash
# Basic Bollinger Bands
npx /chart-to-image --symbol BTC/USDT --timeframe 1h --output bb-basic.png --bb
# Custom period and standard deviations
npx /chart-to-image --symbol ETH/USDT --timeframe 4h --output bb-custom.png \
--bb --bb-period 20 --bb-standard-deviations 2
# Custom colors for bands
npx /chart-to-image --symbol BTC/USDT --timeframe 1h --output bb-colors.png \
--bb --bb-upper-color "#ff6b9d" --bb-middle-color "#4ecdc4" --bb-lower-color "#ff6b9d"
# Background fill between bands
npx /chart-to-image --symbol ETH/USDT --timeframe 4h --output bb-background.png \
--bb --bb-background-color "#ff6b9d" --bb-background-opacity 0.2
# Complete custom Bollinger Bands
npx /chart-to-image --symbol BTC/USDT --timeframe 1h --output bb-complete.png \
--bb --bb-period 20 --bb-standard-deviations 2 \
--bb-upper-color "#ff6b9d" --bb-middle-color "#4ecdc4" --bb-lower-color "#ff6b9d" \
--bb-background-color "#ff6b9d" --bb-background-opacity 0.2
# Bollinger Bands on different chart types
npx /chart-to-image --symbol BTC/USDT --timeframe 1h --output bb-line.png \
--bb --chart-type line --bb-upper-color "#9b59b6" --bb-middle-color "#f39c12" --bb-lower-color "#9b59b6" \
--bb-background-color "#9b59b6" --bb-background-opacity 0.25
npx /chart-to-image --symbol ETH/USDT --timeframe 4h --output bb-area.png \
--bb --chart-type area --bb-upper-color "#e74c3c" --bb-middle-color "#2ecc71" --bb-lower-color "#e74c3c" \
--bb-background-color "#e74c3c" --bb-background-opacity 0.15
npx /chart-to-image --symbol BTC/USDT --timeframe 1d --output bb-heikin.png \
--bb --chart-type heikin-ashi --bb-upper-color "#8e44ad" --bb-middle-color "#e67e22" --bb-lower-color "#8e44ad" \
--bb-background-color "#8e44ad" --bb-background-opacity 0.22
# Bollinger Bands with other indicators
npx /chart-to-image --symbol BTC/USDT --timeframe 1h --output bb-vwap.png \
--bb --vwap --bb-upper-color "#ff6b9d" --bb-middle-color "#4ecdc4" --bb-lower-color "#ff6b9d"
npx /chart-to-image --symbol ETH/USDT --timeframe 4h --output bb-ema.png \
--bb --ema --bb-upper-color "#9b59b6" --bb-middle-color "#f39c12" --bb-lower-color "#9b59b6"
npx /chart-to-image --symbol BTC/USDT --timeframe 1h --output bb-all.png \
--bb --vwap --ema --sma --bb-upper-color "#ff6b9d" --bb-middle-color "#4ecdc4" --bb-lower-color "#ff6b9d" \
--bb-background-color "#ff6b9d" --bb-background-opacity 0.2
```
### π Horizontal Levels
```bash
# Support and resistance levels
npx /chart-to-image --symbol BTC/USDT --timeframe 1h --output levels.png \
--levels "45000:#ff0000:solid:Resistance,40000:#00ff00:dotted:Support"
# Multiple levels with labels
npx /chart-to-image --symbol ETH/USDT --timeframe 4h --output multi-levels.png \
--levels "3000:#ff6b6b:solid:Major Resistance,2500:#4ecdc4:dotted:Support Zone,2800:#f9ca24:solid:Pivot"
```
## π¨ Color Options
### π· Hex Colors
```bash
# Background and text colors
npx /chart-to-image --symbol BTC/USDT --output hex-colors.png \
--background-color "#1a1a2e" --text-color "#00d4ff"
# Custom bar colors with hex
npx /chart-to-image --symbol ETH/USDT --output hex-bars.png \
--custom-colors "bullish=#00ff88,bearish=#ff4444,wick=#ffffff,border=#333333"
```
### π΄ RGB Colors
```bash
# RGB background and text
npx /chart-to-image --symbol BTC/USDT --output rgb-colors.png \
--background-color "rgb(25, 25, 112)" --text-color "rgb(255, 215, 0)"
# RGB bar colors
npx /chart-to-image --symbol ETH/USDT --output rgb-bars.png \
--custom-colors "bullish=rgb(0,255,136),bearish=rgb(255,68,68)"
```
### π·οΈ Named Colors
```bash
# Named color themes
npx /chart-to-image --symbol BTC/USDT --output named-colors.png \
--background-color "midnightblue" --text-color "gold"
# Named bar colors
npx /chart-to-image --symbol ETH/USDT --output named-bars.png \
--custom-colors "bullish=lime,bearish=red,wick=white,border=gray"
```
### π Gradients
```bash
# Linear gradient background
npx /chart-to-image --symbol BTC/USDT --output gradient.png \
--background-color "linear-gradient(135deg, #667eea 0%, #764ba2 100%)" \
--text-color "#ffffff"
# Complex gradient
npx /chart-to-image --symbol ETH/USDT --output complex-gradient.png \
--background-color "linear-gradient(45deg, #667eea 0%, #764ba2 50%, #f093fb 100%)"
```
## ποΈ Hide Elements
### π« Hide Title
```bash
# Clean chart without title
npx /chart-to-image --symbol BTC/USDT --output no-title.png \
--hide-title --background-color "#1a1a2e" --text-color "#00d4ff"
```
### β° Hide Time Axis
```bash
# Chart without time labels
npx /chart-to-image --symbol ETH/USDT --output no-time-axis.png \
--hide-time-axis --background-color "#2d1b69" --text-color "#ff6b6b"
```
### πΈοΈ Hide Grid
```bash
# Chart without grid lines
npx /chart-to-image --symbol ADA/USDT --output no-grid.png \
--hide-grid --background-color "#16213e" --text-color "#4ecdc4"
```
### π§Ή Hide All Elements
```bash
# Ultra-clean chart
npx /chart-to-image --symbol BTC/USDT --output ultra-clean.png \
--hide-title --hide-time-axis --hide-grid \
--background-color "#0f0f23" --text-color "#00ff88"
```
## π Scaling Options
### π Auto Scaling
```bash
# Auto-scale to fit data
npx /chart-to-image --symbol ETH/USDT --output auto-scale.png \
--auto-scale --background-color "#1a1a2e"
```
### βοΈ Manual Scaling
```bash
# Custom X and Y scaling
npx /chart-to-image --symbol BTC/USDT --output manual-scale.png \
--scale-x 1.2 --scale-y 1.1 --background-color "#2d1b69"
```
### π° Price Limits
```bash
# Set price range
npx /chart-to-image --symbol BTC/USDT --output price-limits.png \
--min-scale 45000 --max-scale 50000 --background-color "#16213e"
```
## π’ Exchange Support
| Exchange | Status | Features |
|----------|--------|----------|
| Binance | β
Supported | Full OHLCV data |
| Kraken | β
Supported | Full OHLCV data |
| Coinbase | β
Supported | Full OHLCV data |
| KuCoin | β
Supported | Full OHLCV data |
| OKX | β
Supported | Full OHLCV data |
### π± Exchange Examples
```bash
# Binance (default)
npx /chart-to-image --symbol BTC/USDT --output binance.png
# Kraken
npx /chart-to-image --symbol BTC/USDT --output kraken.png --exchange kraken
# Coinbase
npx /chart-to-image --symbol ETH/USDT --output coinbase.png --exchange coinbase
```
## β±οΈ Timeframes
| Timeframe | Description | Use Case |
|-----------|-------------|----------|
| `1m` | 1 minute | Intraday analysis |
| `5m` | 5 minutes | Short-term trends |
| `15m` | 15 minutes | Medium-term analysis |
| `30m` | 30 minutes | Swing trading |
| `1h` | 1 hour | Daily trading |
| `4h` | 4 hours | Position trading |
| `1d` | 1 day | Long-term analysis |
| `1w` | 1 week | Investment analysis |
### π
Timeframe Examples
```bash
# Intraday (1 minute)
npx /chart-to-image --symbol BTC/USDT --output intraday.png --timeframe 1m
# Short-term (5 minutes)
npx /chart-to-image --symbol ETH/USDT --output short-term.png --timeframe 5m
# Daily (1 hour)
npx /chart-to-image --symbol BTC/USDT --output daily.png --timeframe 1h
# Weekly (1 day)
npx /chart-to-image --symbol ETH/USDT --output weekly.png --timeframe 1d
```
## π Output Formats
| Format | Extension | Quality | Size | Use Case |
|--------|-----------|---------|------|----------|
| PNG | `.png` | High | Medium | Web, printing |
| JPEG | `.jpg`, `.jpeg` | Good | Small | Web, sharing |
### π Format Examples
```bash
# PNG (high quality)
npx /chart-to-image --symbol BTC/USDT --output chart.png
# JPEG (compressed)
npx /chart-to-image --symbol ETH/USDT --output chart.jpg
```
## β οΈ Error Handling
### π¨ Common Errors
| Error | Cause | Solution |
|-------|-------|----------|
| `Invalid symbol format` | Wrong symbol format | Use `BASE/QUOTE` format |
| `Invalid timeframe` | Unsupported timeframe | Use supported timeframes |
| `--output is required` | Missing output path | Add `--output` parameter |
| `--symbol is required` | Missing symbol | Add `--symbol` parameter |
| `Invalid image extension` | Wrong file extension | Use `.png`, `.jpg`, `.jpeg` |
| `Grid layout supports maximum 2 symbols` | Too many symbols for grid | Use max 2 symbols for grid |
| `Grid layout supports maximum 2 columns` | Too many columns for grid | Use max 2 columns for grid |
| `Comparison requires at least 2 symbols` | Not enough symbols | Provide at least 2 symbols |
### β Error Examples
```bash
# β Wrong symbol format
npx /chart-to-image --symbol BTCUSDT --output chart.png
# β
Correct symbol format
npx /chart-to-image --symbol BTC/USDT --output chart.png
# β Invalid timeframe
npx /chart-to-image --symbol BTC/USDT --timeframe 2h --output chart.png
# β
Valid timeframe
npx /chart-to-image --symbol BTC/USDT --timeframe 1h --output chart.png
# β Too many symbols for grid
npx /chart-to-image --compare "BTC/USDT,ETH/USDT,ADA/USDT" --layout grid --output grid.png
# β
Valid grid comparison
npx /chart-to-image --compare "BTC/USDT,ETH/USDT" --layout grid --output grid.png
## π Advanced Examples
### πΌ Professional Trading Chart
```bash
npx /chart-to-image --symbol BTC/USDT --timeframe 4h --output professional.png \
--chart-type candlestick \
--theme dark \
--background-color "#1a1a2e" \
--text-color "#00d4ff" \
--custom-colors "bullish=#00ff88,bearish=#ff4444,wick=#ffffff,border=#333333" \
--width 1200 --height 800 \
--auto-scale
```
### π¨ Minimalist Chart
```bash
npx /chart-to-image --symbol ETH/USDT --timeframe 1d --output minimalist.png \
--chart-type line \
--hide-title --hide-time-axis --hide-grid \
--background-color "#000000" \
--text-color "#00ffff" \
--custom-colors "bullish=#00ff00,bearish=#ff00ff,wick=#ffff00,border=#00ffff"
```
### π Gradient Theme Chart
```bash
npx /chart-to-image --symbol ADA/USDT --timeframe 1h --output gradient-theme.png \
--chart-type area \
--background-color "linear-gradient(135deg, #667eea 0%, #764ba2 100%)" \
--text-color "#ffffff" \
--custom-colors "bullish=#ffd93d,bearish=#ff6b6b,wick=#ffffff,border=#4ecdc4" \
--width 1400 --height 900
```
### π Comparison with Custom Colors
```bash
# Side-by-side with custom theme
npx /chart-to-image --compare "BTC/USDT,ETH/USDT" \
--custom-colors "bullish=#00ff88,bearish=#ff4444,wick=#ffffff,border=#333333" \
--background-color "#1a1a2e" --text-color "#00d4ff" \
--output custom-comparison.png
# Grid comparison with neon theme
npx /chart-to-image --compare "BTC/USDT,ETH/USDT" --layout grid \
--custom-colors "bullish=#00ff00,bearish=#ff00ff,wick=#ffff00,border=#00ffff" \
--background-color "#000000" --text-color "#00ffff" \
--output neon-comparison.png
```
### π Neon Theme Chart
```bash
npx /chart-to-image --symbol BTC/USDT --timeframe 1d --output neon-theme.png \
--chart-type heikin-ashi \
--background-color "#000000" \
--text-color "#00ffff" \
--custom-colors "bullish=#00ff00,bearish=#ff00ff,wick=#ffff00,border=#00ffff" \
--hide-grid
```
### π
Sunset Theme Chart
```bash
npx /chart-to-image --symbol ETH/USDT --timeframe 4h --output sunset-theme.png \
--chart-type candlestick \
--background-color "linear-gradient(to right, #ff6b6b, #4ecdc4)" \
--text-color "#ffffff" \
--custom-colors "bullish=#ffd93d,bearish=#ff6b6b,wick=#ffffff,border=#4ecdc4"
```
### π Data Fetching Only
```bash
# Fetch data without generating chart
npx /chart-to-image --symbol BTC/USDT --timeframe 1h --fetch --limit 50
# Output: JSON data with OHLCV information
```
### π Advanced Comparison Examples
```bash
# Professional trading analysis with indicators
npx /chart-to-image --compare "BTC/USDT,ETH/USDT,ADA/USDT" \
--timeframes "1h,4h,1d" --chart-type heikin-ashi \
--custom-colors "bullish=#00d4aa,bearish=#ff6b6b" \
--background-color "#1a1a2e" --text-color "#00d4ff" \
--vwap --ema --sma --output professional-analysis.png
# Multi-timeframe trend analysis with indicators
npx /chart-to-image --compare "BTC/USDT,BTC/USDT,BTC/USDT,BTC/USDT" \
--timeframes "5m,15m,1h,4h" --chart-type candlestick \
--custom-colors "bullish=#26a69a,bearish=#ef5350" \
--vwap --ema --sma --output trend-analysis.png
# Grid comparison for correlation analysis
npx /chart-to-image --compare "BTC/USDT,ETH/USDT" --layout grid \
--chart-type line --custom-colors "bullish=#4CAF50,bearish=#F44336" \
--background-color "#ffffff" --text-color "#000000" \
--vwap --ema --sma --output correlation-analysis.png
```
## β‘ Performance Tips
### π¦ File Size Optimization
| Format | Optimization | Result |
|--------|-------------|--------|
| PNG | Default | Best quality |
| JPEG | `--quality 0.8` | Smaller size |
| PNG | Raster | High Quality |
### π§ Memory Usage
| Chart Type | Memory Usage | Recommendation |
|------------|-------------|----------------|
| Candlestick | Low | Default choice |
| Line | Very Low | Fast rendering |
| Area | Medium | Good visualization |
| Heikin-Ashi | Low | Trend analysis |
| Renko | Low | Noise filtering |
| Line-Break | Low | Trend continuation |
| Indicator | Memory Usage | Recommendation |
|-----------|-------------|----------------|
| VWAP | Low | Institutional analysis |
| EMA | Very Low | Trend analysis |
| Combined | Low | Comprehensive analysis |
### π Comparison Performance
| Comparison Type | Memory Usage | Use Case |
|----------------|-------------|----------|
| Side-by-side | Medium | Symbol correlation |
| Grid (2 charts) | Medium | Focused comparison |
| Timeframe | Medium | Technical analysis |
| Multi-symbol | High | Market overview |
### β‘ Rendering Speed
| Feature | Impact | When to Use |
|---------|--------|-------------|
| Auto-scale | Fast | Most cases |
| Manual scaling | Medium | Precise control |
| Custom colors | Low | Always available |
| Hide elements | Fast | Clean charts |
| Gradients | Medium | Visual appeal |
| Chart comparison | Medium | Market analysis |
| Timeframe comparison | Medium | Technical analysis |
| Grid layout | Medium | Focused comparison |
## π§ Troubleshooting
### π¨ Common Issues
| Issue | Cause | Solution |
|-------|-------|----------|
| Chart not rendering | Invalid symbol | Check symbol format |
| Empty chart | No data available | Try different timeframe |
| Color not applied | Invalid color format | Use hex, rgb, or named colors |
| File not saved | Permission error | Check write permissions |
| Build errors | TypeScript issues | Run `npm run build` |
### π Debug Commands
```bash
# Check if data is available
npx /chart-to-image --symbol BTC/USDT --timeframe 1h --fetch --limit 10
# Test with minimal options
npx /chart-to-image --symbol BTC/USDT --output test.png
# Verify file creation
ls -la test.png
```
## β
Best Practices
### π¨ Chart Design
1. **Choose appropriate chart type** for your analysis
2. **Use consistent color schemes** across charts
3. **Hide unnecessary elements** for clean presentation
4. **Set appropriate dimensions** for your use case
5. **Use auto-scaling** for most cases
### β‘ Performance
1. **Use PNG for quality**, JPEG for size
2. **Limit data points** for faster rendering
3. **Cache generated charts** when possible
4. **Use appropriate timeframes** for your analysis
### π‘οΈ Error Prevention
1. **Always specify output path**
2. **Use valid symbol formats**
3. **Check exchange availability**
4. **Validate color formats**
5. **Test with minimal options first**
---
For more information, see the [README.md](./README.md) or visit the [GitHub repository](https://github.com/NeaByteLab/Chart-To-Image).