FCS Advanced Chart Library

FCS Advanced Chart is a lightweight, high-performance charting library for financial markets. Display real-time candlestick, line, and area charts with technical indicators and drawing tools. Designed for forex, crypto, and stock trading platforms with TradingView-like functionality.

Why Use FCS Chart?

Our chart library provides professional-grade charting capabilities with minimal resource usage. Perfect for trading platforms, market analysis tools, and financial dashboards that need real-time data visualization.

Key Features

Real-time updates - WebSocket integration for live price data
Multiple chart types - Candlestick, Bars, Line, Area, Heikin-Ashi, Renko and more
Technical indicators - 50+ built-in indicators (MA, RSI, MACD, Bollinger Bands, etc.)
Drawing tools - Trend lines, Fibonacci, patterns, and annotations
Broker Integration - Horizontal Line API for TP/SL/Entry price lines
Lightweight - Optimized for low CPU/RAM usage on browsers and mobile

What You Get:
  • 9 chart types: Candlestick, Bars, Line, Area, Hollow, Heikin-Ashi, High-Low, Volume Candles, Renko
  • 50+ technical indicators with customizable settings
  • Drawing tools: Trend lines, Fibonacci, ABCD patterns, annotations
  • Multi-timeframe support: 1m, 5m, 15m, 30m, 1H, 4H, 1D, 1W, 1M + custom timeframes
  • Horizontal Line API for brokers (TP/SL/Entry price lines)
  • Replay mode for backtesting strategies
  • Screenshot/export functionality
  • Dark and Light themes
  • Responsive design for desktop and mobile

Get Started in 3 Steps

Start displaying professional financial charts in minutes. Just include our library, create a container, and initialize the chart.

Step 1: Include the Library

Add the CSS and JavaScript files to your HTML:

<!-- CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/fcsapi/chart-js/src/fcsapi-chart.css">

<!-- JavaScript -->
<script src="https://cdn.jsdelivr.net/gh/fcsapi/chart-js/src/fcsapi-chart.js"></script>

Step 2: Create Chart Container

Add a container element for the chart:

<div id="fcs_chartparent">
    <div id="fcs_chart"></div>
</div>

Step 3: Initialize the Chart

Create a new chart instance with your configuration:

const chart = new FCSAPIChart({
    container: document.getElementById('fcs_chart'),
    parentid: 'fcs_chartparent',
    accessKey: 'YOUR_API_KEY',
    symbol: 'BINANCE:BTCUSDT',
    period: '1H'
});
API Key Required

You need a valid API key to load chart data. Get your API key from your dashboard. For testing, use free or test as access key.


Library Installation

Download and include the FCS Chart library files in your project. The library consists of a CSS file for styling and a JavaScript file for functionality.

CDN (Recommended)

Include from GitHub CDN - no download required:

<!-- CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/fcsapi/chart-js/src/fcsapi-chart.css">

<!-- JavaScript -->
<script src="https://cdn.jsdelivr.net/gh/fcsapi/chart-js/src/fcsapi-chart.js"></script>

Container Setup

The chart requires two nested containers:

<div id="fcs_chartparent" style="width: 100%; height: 600px;">
    <div id="fcs_chart"></div>
</div>

Important: The parent container (fcs_chartparent) must have a defined height. The inner container (fcs_chart) will be managed by the chart library.

Mobile Height Fix

For full-height charts on mobile devices, use this JavaScript:

function setMobileHeight() {
    const vh = window.innerHeight;
    document.getElementById('fcs_chartparent').style.height = vh + 'px';
}
setMobileHeight();
window.addEventListener('resize', setMobileHeight);
CDN Links

CSS:
https://cdn.jsdelivr.net/gh/fcsapi/chart-js/src/fcsapi-chart.css

JavaScript:
https://cdn.jsdelivr.net/gh/fcsapi/chart-js/src/fcsapi-chart.js

Requirements:
  • Browser: Modern browsers with ES6 support (Chrome, Firefox, Safari, Edge)
  • Container: Parent element must have defined width and height
  • API Key: Valid FCS API key for data access
  • Socket Key: Optional WebSocket key for real-time updates

Chart Configuration Options

Configure your chart with these options. Only container, parentid, and accessKey are required - all other options have sensible defaults.

Required Settings

OptionTypeDescription
containerElement*required Chart container DOM element
parentidString*required Parent container ID for toolbar/sidebar positioning
accessKeyString*required Your FCS API access key
socketApiKeyStringoptional WebSocket API key for live price updates

Core Chart Settings

OptionTypeDefaultDescription
symbolStringBINANCE:BTCUSDTDefault symbol to load (format: EXCHANGE:SYMBOL)
periodString1HDefault timeframe: 1m, 5m, 15m, 30m, 1H, 4H, 1D, 1W, 1M
lengthNumber600Number of candles to load (max depends on API plan)
enableCacheBooleantrueCache user's last symbol/period/settings in localStorage
changeURLBooleantrueUpdate browser URL with symbol/period (shareable links)

Display Mode

OptionTypeDefaultDescription
displayModeStringnormalnormal = full UI with toolbar/sidebar | chartonly = hide all UI, show only chart

Appearance

OptionTypeDefaultDescription
themeStringdarkdark | light
defaultChartTypeStringcandlestickcandlestick | bars | line | area | hollow | heikin-ashi | high-low | volume-candles
timezoneStringlocallocal | UTC | +05:00 | -08:00 etc.
Configuration Tips

Symbol Format: Always use EXCHANGE:SYMBOL format (e.g., BINANCE:BTCUSDT, NASDAQ:AAPL, FX:EURUSD)

Performance: Use displayMode: "chartonly" for embedded charts to reduce memory usage

Caching: Enable enableCache to remember user preferences across sessions


UI Layout Toggles

Control which UI elements are visible on your chart. Disable elements you don't need to create a cleaner interface or reduce memory usage.

Main Layout Elements

OptionDefaultDescription
enableSidebartrueLeft sidebar with drawing tools (trend lines, fibonacci, shapes, etc.)
enableToolbartrueTop toolbar with all controls (search, indicators, settings, etc.)
enableRangeSelectortrueBottom time range selector bar for quick navigation

Toolbar Controls

OptionDefaultDescription
enableSearchtrueSymbol search button and search panel
enableIndicatorstrueIndicators button and indicator selection panel
enableMultiCharttrueMulti-chart layouts button (1/2/3/4 charts)
enableReplaytrueReplay mode button for backtesting
enableCapturetrueScreenshot/export button
enableUndoRedotrueUndo/Redo buttons (also Ctrl+Z, Ctrl+Y)
enableTemplatestrueTemplate save/load functionality
enableSettingstrueSettings gear button for chart preferences
enableSymbolInfotrueSymbol info button (shows profile/stats)
enableChartTypeSelectortrueChart type dropdown selector in toolbar
enableTimeframeSelectortrueTimeframe/period dropdown selector in toolbar
Minimal Chart Mode

For an embedded chart without UI controls, use:
displayMode: "chartonly"

Or disable individual elements:
enableSidebar: false,
enableToolbar: false,
enableRangeSelector: false


Chart Features Configuration

Enable or disable specific chart features like real-time updates, drawing tools, grid lines, and price labels.

Core Features

OptionDefaultDescription
enableSockettrueWebSocket for live price updates (requires socketApiKey)
enableContextMenutrueRight-click context menu on chart
enableDrawingToolstrueEnable drawing tools functionality

Grid & Crosshair

OptionDefaultDescription
enableGridfalseShow grid lines on chart background
enableCrosshairtrueShow crosshair on mouse hover
enableCrosshairLabelstrueShow price/time labels on crosshair axes

Price Labels & Lines

OptionDefaultDescription
enablePriceLinetrueCurrent price horizontal line and label
enableAskBidLinesfalseAsk/Bid price lines (requires socket connection)
enableAskPriceLabelstrueAsk price label on price axis
enableBidPriceLabelstrueBid price label on price axis
enableHighLowLabelstrueHigh/Low price labels on visible chart area

Indicator Settings

OptionDefaultDescription
enableIndicatorLabelstrueShow indicator name labels on chart panels
enableOHLCBartrueShow OHLC values bar in top-left corner
indicatorPanelBgColornullPanel background color (null = use theme background)

Scale Settings

OptionDefaultDescription
autoScaletrueAuto-scale price vertical axis to visible data
logScalefalseUse logarithmic price scale

Drawing Settings

OptionDefaultDescription
defaultMagnetModefalseSnap drawing points to candle OHLC values
Custom Colors

Customize price label colors with hex values:
askLabelColor: "#00bcd4" (cyan)
bidLabelColor: "#ff9800" (orange)
lastPriceLabelColor: null (uses candle up/down color)


Chart API Methods

Control your chart programmatically using these API methods. Change symbols, timeframes, themes, and more at runtime.

Symbol & Period

// Change symbol
chart.setSymbol('NASDAQ:AAPL');

// Change timeframe
chart.setPeriod('4H');

// Both at once
chart.setSymbol('BINANCE:ETHUSDT');
chart.setPeriod('1D');

Theme & Chart Type

// Switch theme
chart.setTheme('light');  // 'dark' | 'light'

// Change chart type
chart.setChartType('line');
// Options: candlestick, bars, line, area,
// hollow, heikin-ashi, high-low, volume-candles

Export & Capture

// Get chart as base64 image
const imageData = chart.exportImage();

// Use the image
const img = new Image();
img.src = imageData;
document.body.appendChild(img);

// Or download
const link = document.createElement('a');
link.download = 'chart.png';
link.href = imageData;
link.click();

Resize

// Recalculate dimensions after container resize
chart.resize();

// Example: call after window resize
window.addEventListener('resize', () => {
    chart.resize();
});

Cleanup

// Remove chart and cleanup resources
chart.destroy();

// Important: Call this when removing chart from page
// to prevent memory leaks
Console Access

Access chart instance in browser console for debugging:
console.log(chart.engine.data.length);
console.log(chart.engine.socketManager?.getConnectionStatus());

Response Format

Response Fields

  • setSymbol(symbol) - Change the displayed symbol. Format: EXCHANGE:SYMBOL
  • setPeriod(period) - Change timeframe. Values: 1m, 5m, 15m, 30m, 1H, 4H, 1D, 1W, 1M
  • setTheme(theme) - Switch between dark and light themes
  • setChartType(type) - Change chart visualization type
  • exportImage() - Returns base64-encoded PNG image of the chart
  • resize() - Recalculate chart dimensions after container resize
  • destroy() - Remove chart and cleanup all event listeners and resources
Best Practices:
  • Always call destroy() when removing chart from DOM
  • Call resize() after any container size changes
  • Wait for chart initialization before calling API methods
  • Symbol format must include exchange prefix (BINANCE:, NASDAQ:, FX:)

Horizontal Line API (for Brokers)

Programmatically add, update, and remove horizontal price lines on the chart. Perfect for displaying Take Profit (TP), Stop Loss (SL), and Entry price levels for trading orders.

addHorizontalLine(options)

Add a horizontal line at a specific price. Returns a Promise with the line ID:

// Add Take Profit line (async/await)
const tpLine = await chart.addHorizontalLine({
    price: 45000,
    color: '#00ff00',
    label: 'TP',
    style: 'dashed'
});

// Add Stop Loss line (Promise.then)
chart.addHorizontalLine({
    price: 42000,
    color: '#ff0000',
    label: 'SL',
    style: 'dashed'
}).then(slLine => {
    console.log('SL Line ID:', slLine);
});

// Add Entry line with all options
const entryLine = await chart.addHorizontalLine({
    price: 43500,
    color: '#2196f3',
    label: 'Entry',
    style: 'solid',        // 'solid' | 'dashed'
    lineWidth: 2,
    textPosition: 'above-left',
    textColor: '#ffffff',
    textSize: 12,
    id: 'my-entry-line'    // Optional custom ID
});

Line Options

OptionTypeDefaultDescription
priceNumber* requiredPrice level for the line
colorString#ff6d00Line color (hex)
labelString''Text label (TP, SL, Entry)
styleStringsolid'solid' or 'dashed'
lineWidthNumber2Line thickness in pixels
textPositionStringabove-centerabove-left, above-center, above-right, below-left, below-center, below-right
textColorString#ffffffLabel text color
textSizeNumber12Label font size
idStringautoCustom ID (auto-generated if not provided)

updateHorizontalLine(lineId, options)

Update an existing line (e.g., when user drags an order):

// Move TP line to new price
chart.updateHorizontalLine(tpLine, { price: 46000 });

// Change color and label
chart.updateHorizontalLine(slLine, {
    price: 41500,
    color: '#ff5722',
    label: 'SL (adjusted)'
});

removeHorizontalLine(lineId)

Remove a line (when order is filled/cancelled):

// Remove single line
chart.removeHorizontalLine(tpLine);

// Remove by custom ID
chart.removeHorizontalLine('my-entry-line');

getHorizontalLines()

Get all programmatic lines:

const lines = chart.getHorizontalLines();
console.log(lines);
// [{id: 'abc', price: 45000, color: '#00ff00', label: 'TP', ...}, ...]

clearHorizontalLines()

Remove all programmatic lines:

const count = chart.clearHorizontalLines();
console.log('Removed', count, 'lines');
Use Cases

Trading Platforms: Display pending orders on chart
Order Management: Show TP/SL levels for open positions
Alerts: Visualize price alert levels
Analysis: Mark important support/resistance levels

Response Format

Response Fields

  • addHorizontalLine(options) - Add a horizontal line, returns Promise with line ID
  • updateHorizontalLine(id, options) - Update an existing line's properties
  • removeHorizontalLine(id) - Remove a specific line by ID
  • getHorizontalLines() - Get array of all programmatic lines
  • clearHorizontalLines() - Remove all programmatic lines, returns count
Best Practices:
  • Use custom IDs to easily track and update order lines
  • Use green (#00ff00) for TP, red (#ff0000) for SL, blue (#2196f3) for Entry
  • Use dashed style for pending orders, solid for filled orders
  • Remove lines when orders are cancelled or filled
  • Update line price when order is modified

Available Chart Types

FCS Chart supports 9 different chart visualization types. Each type offers a different way to view price data, suitable for different analysis needs.

Chart Types

TypeValueDescription
CandlestickcandlestickTraditional Japanese candlesticks showing OHLC with colored bodies
Bars (OHLC)barsOHLC bars with horizontal ticks for open/close
LinelineSimple line chart connecting close prices
AreaareaLine chart with filled area below
Hollow CandleshollowHollow candlesticks - filled when close < open, hollow when close > open
Heikin-Ashiheikin-ashiModified candlesticks using averaged values to filter noise
High-Lowhigh-lowSimple bars showing only high and low prices
Volume Candlesvolume-candlesCandlesticks with width proportional to volume
RenkorenkoPrice movement bricks that filter out minor price movements

Usage

// Set default chart type on initialization
const chart = new FCSAPIChart({
    container: document.getElementById('fcs_chart'),
    parentid: 'fcs_chartparent',
    accessKey: 'YOUR_KEY',
    defaultChartType: 'candlestick'  // Set default type
});

// Change chart type at runtime
chart.setChartType('heikin-ashi');
chart.setChartType('line');
chart.setChartType('area');
Chart Type Tips

Candlestick: Best for detailed price action analysis
Heikin-Ashi: Smooths out noise, good for trend identification
Line/Area: Clean view for long-term trend analysis
Volume Candles: See volume and price together


Available Timeframes

FCS Chart supports multiple timeframes from 1 minute to 1 month, plus custom timeframes. Choose the appropriate timeframe for your analysis needs.

Supported Timeframes

CategoryValuesDescription
Minutes1m, 2m, 3m, 5m, 10m, 15m, 30mShort-term intraday trading and scalping
Hours1H, 2H, 4H, 6H, 8H, 12HDay trading and swing trading
Days1DPosition trading and long-term analysis
Weeks1WLong-term trend analysis
Months1MVery long-term investment analysis

Usage

// Set default timeframe on initialization
const chart = new FCSAPIChart({
    container: document.getElementById('fcs_chart'),
    parentid: 'fcs_chartparent',
    accessKey: 'YOUR_KEY',
    period: '1H'  // Default to 1 hour
});

// Change timeframe at runtime
chart.setPeriod('1D');  // Switch to daily
chart.setPeriod('15m'); // Switch to 15 minutes
chart.setPeriod('4H');  // Switch to 4 hours
Custom Timeframes

You can use the CUSTOM option in the UI to create custom timeframes like 7m, 25m, 3H, etc. This allows flexibility for specific trading strategies.

Scalping: Use 1m, 2m, 5m for quick trades
Day Trading: Use 15m, 30m, 1H for intraday moves
Swing Trading: Use 4H, 1D for multi-day positions
Investing: Use 1D, 1W, 1M for long-term trends


Full Working Example

A complete, production-ready example showing all features: configuration, theme switching, symbol search, and responsive layout.

Live Examples

Try Live Demo:
Full Featured Example - Complete implementation with all options

GitHub CDN:
https://cdn.jsdelivr.net/gh/fcsapi/chart-js/src/fcsapi-chart.js
https://cdn.jsdelivr.net/gh/fcsapi/chart-js/src/fcsapi-chart.css

Source Code:
GitHub Repository

Best Practices:
  • Container Height: Always set a fixed height on the parent container
  • Mobile Support: Use the mobile height fix for full-screen charts
  • API Keys: Never expose production API keys in client-side code
  • Cleanup: Call chart.destroy() when removing chart from page
  • Performance: Use displayMode: "chartonly" for embedded widgets
  • Caching: Enable enableCache for better user experience

Common Issues & Solutions

Quick solutions to common chart setup and usage issues.

Common Issues

IssueCauseSolution
Chart not visibleContainer has no heightSet explicit height on parent container (e.g., height: 600px or 100vh)
No data loadingInvalid API keyCheck your API key is valid and has chart access enabled
No live updatesSocket not connectedProvide valid socketApiKey and ensure enableSocket: true
Symbol not foundWrong symbol formatUse EXCHANGE:SYMBOL format (e.g., BINANCE:BTCUSDT not just BTCUSDT)
UI not showingdisplayMode is chartonlySet displayMode: "normal" or remove the option
Chart cut off on mobileViewport height issueUse the mobile height fix (see Installation section)
Need Help?

Contact support at support@fcsapi.com with your API key, browser console errors, and code samples for faster resolution.

Debugging Tips:
  • Check browser console (F12) for error messages
  • Verify API key in dashboard is active
  • Ensure chart container has defined dimensions
  • Test with the live demo first to verify API key works
  • Check network tab for failed API requests
  • Use console.log(chart.engine) to inspect chart state

Terms & Disclaimer

Important legal information about chart data usage, accuracy, and limitations.

Data Accuracy

Chart data is sourced from multiple exchanges and liquidity providers. While we strive for accuracy, data may not be 100% accurate or suitable for high-frequency trading decisions.

Trading Disclaimer

Charts, indicators, and signals displayed are for informational and educational purposes only. They are NOT intended as trading advice. We bear NO responsibility for any trading losses incurred from using this chart library.

Technical Indicators

All technical indicators are mathematical calculations based on historical price data. Past performance does not guarantee future results. Always use multiple sources of analysis.

Important Notice

Always consult licensed financial advisors before making investment decisions. This chart library is a tool for visualization, not a substitute for professional financial advice.

Key Points:
  • Chart data is for informational purposes only
  • Not suitable as sole basis for trading decisions
  • Prices may differ from actual market prices
  • No liability for trading losses or missed opportunities
  • Technical indicators are tools, not guarantees
  • Always verify data with official exchange sources
By using the FCS Chart Library, you agree to our Terms of Service and Privacy Policy.