Implementing Syncfusion React Stock Charts
The Stock Chart component is a specialized financial chart for visualizing stock price movements over time. It provides essential features for financial data analysis including candlestick/OHLC visualization, period selectors for quick date range navigation, range selectors for precise data filtering, technical indicators, and interactive tools like tooltips and crosshair.
When to Use This Skill
Use this skill when you need to:
- Visualize financial/stock data - Display stock prices, trading volumes, market movements
- Display OHLC data - Show Open, High, Low, Close values with candlestick or Hilo charts
- Implement period navigation - Add quick time range buttons (1D, 5D, 1M, 6M, YTD, 1Y, ALL)
- Enable range selection - Allow users to select specific date ranges with thumb navigation
- Add technical analysis - Include technical indicators (SMA, EMA, RSI, MACD, etc.)
- Show stock events - Visualize earnings, dividends, splits, or other market events
- Create financial dashboards - Build comprehensive stock analysis interfaces
- Display time-series data - Any datetime-based financial or trading data
Component Overview
Package: @syncfusion/ej2-react-charts
Component: StockChartComponent
Key Features:
- 6 series types (Line, Spline, Hilo, HiloOpenClose, Candle, Hollow Candle)
- Built-in period selector for quick date range navigation
- Range navigator with thumb controls for precise selection
- Technical indicators (20+ types) and
indicatorType support
- Stock event annotations (
stockEvents) and stockEventRender
- Interactive tooltip, crosshair (trackball), and legend
- Selection and interaction:
selectionMode, isMultiSelect, selectedDataIndexes
- Zooming and panning (
zoomSettings, onZooming)
- Export to image/PDF and print capabilities (
exportType, Export, Print)
- Persistence and RTL support (
enablePersistence, enableRtl)
- Responsive and accessible (WCAG, ARIA, keyboard navigation)
Documentation and Navigation Guide
Getting Started
📄 Read: references/getting-started.md
Read this first for initial setup:
- Installing @syncfusion/ej2-react-charts package
- Project setup with Vite or create-react-app
- Basic StockChartComponent implementation
- Module injection pattern (Inject services)
- Creating first chart with sample data
- Understanding data structure (x, open, high, low, close, volume)
- Adding chart title and basic configuration
Axis Types and Configuration
📄 Read: references/configuration.md
For configuring and customizing axes:
- DateTime Axis - Date/time based x-axis (most common for stock charts)
- DateTimeCategory Axis - Business days only (excludes weekends/holidays)
- Logarithmic Axis - Logarithmic scale for wide value ranges
- Numeric Axis - Standard numeric axis for y-values
- Axis title, labels, and formatting
- Grid lines and tick customization
- Multiple Y-axes for different data scales
- Axis ranges and padding settings
Series Types and Visualization
📄 Read: references/series-types.md
For choosing and configuring chart series:
- Line series - Continuous price lines
- Spline series - Smooth curves
- Hilo series - High-low range bars
- HiloOpenClose series - OHLC bars
- Candle series - Traditional candlesticks (default for stock charts)
- Hollow Candle series - Filled/hollow based on price movement
- Bear/Bull fill colors for candlesticks
- Series dropdown navigation and type switching
- Module injection for each series type
- When to use each type
Period and Range Selectors
📄 Read: references/selectors.md
For implementing time range navigation:
- Period Selector: Quick navigation buttons (1D, 5D, 1M, etc.)
- Periods array configuration (interval, text, intervalType)
- IntervalType options (Years, Months, Weeks, Days, Hours, etc.)
- Enabling/disabling period selector
- Range Selector: Precise range selection with thumbs
- Thumb navigation and dragging
- Label tapping for range selection
- Date range button integration
- Enabling/disabling range selector
Interactive Features and Events
📄 Read: references/interactive-features.md
For adding user interaction and visual feedback:
- Legend: Display series information
- Position and alignment options (Top, Bottom, Left, Right, Custom)
- Customization (size, shape, colors, icons)
- Legend title and template
- Legend click/render events
- Tooltip: Show point data on hover
- Format customization with tokens (${point.x}, ${point.open}, etc.)
- Position control (Auto, Nearest)
- Appearance styling (fill, border, textStyle)
- Shared tooltips for multi-series
- Header and custom formatting
- Crosshair: Vertical/horizontal lines for precise value reading
- Crosshair tooltip for axis values on both axes
- Line customization (width, color, dashArray)
- Snap to data for cleaner interactions
- Trackball mode for shared tooltip across series
- Line type (Both, Vertical, Horizontal)
- Mouse Events: Comprehensive interaction tracking
- pointClick, pointMove for data point interactions
- stockChartMouseMove, stockChartMouseClick, etc.
- stockChartMouseLeave for UI cleanup
- Range change events for selector updates
Technical Analysis Tools
📄 Read: references/technical-analysis.md
For financial analysis features:
- Stock Events: Annotate significant market events
- Event types (Flag, Circle, Square, Triangle, etc.)
- Event markers with customizable colors and shapes
- Event descriptions and tooltips
- Events for specific series targeting
- stockEventRender event for custom styling
- Event visibility control
- Technical Indicators: Add analysis overlays
- 10+ indicator types:
- Moving averages: SMA, EMA, TMA
- Momentum: RSI, MACD, Stochastic, Momentum
- Volume: Accumulation Distribution, ATR
- Advanced: Bollinger Bands
- Indicator configuration and styling
- Multiple indicators on one chart
- Field selection (Open, High, Low, Close)
- Period and standard deviation customization
- Trend Lines: Draw trend analysis lines
- 6 trendline types: Linear, Exponential, Logarithmic, Polynomial, Power, MovingAverage
- Line configuration (start/end points, series binding)
- Styling and customization (color, width, dashArray)
- Multiple trend lines per series
- Polynomial order customization
- Moving average period configuration
Tooltip, Crosshair, and Axis Configuration
📄 Read: references/interactive-features.md and references/configuration.md
For tooltip and crosshair setup:
- Tooltip Configuration: Point hover information
- Enable/disable with
enable property
- Format strings for OHLC data display
- Background color and border styling
- Text style customization
- Position modes (Auto, Nearest)
- Crosshair Lines: Precise value reading
- Enable crosshair with
enable: true
- Line type: Both, Vertical, or Horizontal
- Line customization (width, color, dashArray)
- Snap to data point alignment
- Crosshair line styling
- Axis Tooltips: Display axis values
- Enable on primaryXAxis via
crosshairTooltip
- Enable on primaryYAxis via
crosshairTooltip
- Fill color and text style customization
- Format axis value display
Chart Configuration and Styling
📄 Read: references/configuration.md
For customizing chart appearance and behavior:
- Axes Configuration: Setup X and Y axes
- Axis types: DateTime (default), DateTimeCategory, Logarithmic, Numeric
- Label formatting and intervals
- Multiple axes support with
axes array
- Axis ranges, padding, and grid lines
- Major/minor tick and grid customization
- Chart Dimensions: Control size
- Width and height properties (pixels or percentage)
- Responsive sizing strategies
- Container-based sizing
- Appearance: Theme and styling
- Built-in themes (Material, Fabric, Bootstrap, HighContrast, etc.)
- Background and border customization
- Chart area styling
- Margin and padding configuration
- Title and title styling
- Gradient Fills: Advanced styling
- Linear gradients (x1, y1, x2, y2 stops)
- Radial gradients (cx, cy, r stops)
- Gradient for series fill
- SVG gradient definitions
Export, Print, and Accessibility
📄 Read: references/utilities.md
For export functionality and accessibility:
- Export: Save charts as files
- Export as PNG, JPEG, SVG
- Export as PDF
- Configuration options
- Print: Print chart directly
- Accessibility: WCAG compliance
- Keyboard navigation
- ARIA attributes
- Screen reader support
- Accessible color schemes
Quick Start
Basic Stock Chart
import { StockChartComponent, StockChartSeriesCollectionDirective,
StockChartSeriesDirective, Inject, DateTime, Tooltip,
RangeTooltip, Crosshair, LineSeries, SplineSeries,
CandleSeries, HiloOpenCloseSeries, HiloSeries,
RangeAreaSeries, Trendlines } from '@syncfusion/ej2-react-charts';
import * as React from 'react';
function App() {
const data = [
{ x: new Date('2012-04-02'), open: 85.97, high: 90.58, low: 85.97, close: 90.58, volume: 660187068 },
{ x: new Date('2012-04-09'), open: 89.02, high: 92.50, low: 88.50, close: 92.90, volume: 490033264 },
{ x: new Date('2012-04-16'), open: 92.52, high: 93.00, low: 88.50, close: 92.52, volume: 450167016 },
// ... more data
];
return (
<StockChartComponent
id='stockchart'
title='AAPL Stock Price'
primaryXAxis={{ valueType: 'DateTime' }}
>
<Inject services={[DateTime, Tooltip, RangeTooltip, Crosshair, LineSeries,
SplineSeries, CandleSeries, HiloOpenCloseSeries, HiloSeries,
RangeAreaSeries, Trendlines]} />
<StockChartSeriesCollectionDirective>
<StockChartSeriesDirective
dataSource={data}
type='Candle'
xName='x'
high='high'
low='low'
open='open'
close='close'
volume='volume'
/>
</StockChartSeriesCollectionDirective>
</StockChartComponent>
);
}
export default App;
Stock Chart with Period Selector
import { StockChartComponent, StockChartSeriesCollectionDirective,
StockChartSeriesDirective, Inject, DateTime, Tooltip,
RangeTooltip, Crosshair, CandleSeries } from '@syncfusion/ej2-react-charts';
function App() {
const data = [ /* stock data */ ];
const periods = [
{ intervalType: 'Days', interval: 1, text: '1D' },
{ intervalType: 'Days', interval: 5, text: '5D' },
{ intervalType: 'Months', interval: 1, text: '1M' },
{ intervalType: 'Months', interval: 3, text: '3M' },
{ intervalType: 'Months', interval: 6, text: '6M' },
{ intervalType: 'Years', interval: 1, text: '1Y' },
{ text: 'All' }
];
return (
<StockChartComponent
id='stockchart'
title='Stock Analysis'
primaryXAxis={{ valueType: 'DateTime' }}
periods={periods}
enablePeriodSelector={true}
>
<Inject services={[DateTime, Tooltip, RangeTooltip, Crosshair, CandleSeries]} />
<StockChartSeriesCollectionDirective>
<StockChartSeriesDirective
dataSource={data}
type='Candle'
xName='x'
high='high'
low='low'
open='open'
close='close'
/>
</StockChartSeriesCollectionDirective>
</StockChartComponent>
);
}
CSS Styling for Stock Chart
For the Stock Chart period selector UI to work properly, you need to include the required CSS stylesheets in your HTML file. Add the following <link> tags to the <head> section of your index.html:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<!-- Syncfusion Tailwind CSS for Stock Chart styling -->
<link href="https://cdn.syncfusion.com/ej2/33.1.44/tailwind3.css" rel="stylesheet" />
<!-- Bootstrap CSS for additional styling support -->
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<title>Stock Chart App</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
Key CSS Stylesheets:
Syncfusion Tailwind CSS (tailwind3.css) - Required for Stock Chart components
- Version: 33.1.44 (update to match your Syncfusion version)
- Provides styling for period selector buttons, range navigator, tooltips, and other UI elements
- CDN URL:
https://cdn.syncfusion.com/ej2/33.1.44/tailwind3.css
Bootstrap CSS - Optional but recommended for additional styling support
- Version: 3.3.7
- Provides base styling and layout utilities
- CDN URL:
https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css
Important Notes:
- Ensure the Syncfusion CSS version matches your
@syncfusion/ej2-react-charts package version
- If you're using a different theme (Material, Bootstrap, Fabric, HighContrast), use the corresponding CSS file from Syncfusion CDN
- Place these stylesheets before other custom stylesheets to allow proper CSS cascade and overrides
- Without these stylesheets, the period selector buttons, tooltips, and other UI elements may not render correctly
Alternative CSS URLs by Theme:
- Material:
https://cdn.syncfusion.com/ej2/33.1.44/material.css
- Bootstrap:
https://cdn.syncfusion.com/ej2/33.1.44/bootstrap.css
- Fabric:
https://cdn.syncfusion.com/ej2/33.1.44/fabric.css
- Tailwind:
https://cdn.syncfusion.com/ej2/33.1.44/tailwind3.css
- HighContrast:
https://cdn.syncfusion.com/ej2/33.1.44/highcontrast.css
Axis Types Reference
Stock Chart supports multiple axis types for different data scenarios:
DateTime Axis (Default)
Use for date-based stock data:
primaryXAxis={{
valueType: 'DateTime',
majorGridLines: { width: 0 },
majorTickLines: { color: 'transparent' }
}}
Best for: Stock price data with dates
Inject: DateTime module
DateTimeCategory Axis
Displays only business days (excludes weekends/holidays):
primaryXAxis={{
valueType: 'DateTimeCategory',
majorGridLines: { width: 0 }
}}
Best for: Business day-only trading data
Inject: DateTimeCategory module
Note: Requires DateTimeCategory module import and injection
Logarithmic Axis
For Y-axis with logarithmic scale (useful for wide value ranges):
primaryYAxis={{
valueType: 'Logarithmic',
labelFormat: '${value}'
}}
Best for: Data spanning multiple orders of magnitude
Inject: Logarithmic module
Note: Cannot contain zero or negative values
Numeric Axis (Y-axis default)
Standard linear numeric scale:
primaryYAxis={{
valueType: 'Double',
labelFormat: '${value}',
minimum: 0,
maximum: 500,
interval: 50
}}
Best for: Price values and general Y-axis
No module injection required - This is the default
Multi-Axis Configuration
Use multiple Y-axes for different scales:
<StockChartComponent
primaryXAxis={{ valueType: 'DateTime' }}
primaryYAxis={{ title: 'Price', labelFormat: '${value}' }}
>
{/* Additional axes using StockChartAxesDirective */}
<StockChartAxesDirective>
<StockChartAxisDirective
name='volumeAxis'
opposedPosition={true}
title='Volume'
labelFormat='{value}M'
/>
</StockChartAxesDirective>
{/* Series bind to respective axes */}
<StockChartSeriesCollectionDirective>
<StockChartSeriesDirective type='Candle' yAxisName='primaryYAxis' />
<StockChartSeriesDirective type='Column' yAxisName='volumeAxis' />
</StockChartSeriesCollectionDirective>
</StockChartComponent>
Common Patterns
Pattern 1: Financial Dashboard with Multiple Features
import { StockChartComponent, StockChartSeriesCollectionDirective,
StockChartSeriesDirective, Inject, DateTime, Tooltip,
RangeTooltip, Crosshair, CandleSeries, StockLegend,
Export, Print } from '@syncfusion/ej2-react-charts';
function FinancialDashboard() {
const handlePointClick = (args) => {
console.log(`Point clicked: ${args.x}, Value: ${args.y}`);
};
const handleMouseMove = (args) => {
console.log('Mouse moved over chart');
};
const handleRangeChange = (args) => {
console.log(`Range changed: ${args.start} to ${args.end}`);
};
return (
<StockChartComponent
id='stockchart'
title='Comprehensive Stock Analysis'
primaryXAxis={{ valueType: 'DateTime' }}
tooltip={{ enable: true, shared: true }}
crosshair={{ enable: true }}
legendSettings={{ visible: true }}
enablePeriodSelector={true}
enableSelector={true}
pointClick={handlePointClick}
stockChartMouseMove={handleMouseMove}
rangeChange={handleRangeChange}
>
<Inject services={[DateTime, Tooltip, RangeTooltip, Crosshair,
CandleSeries, StockLegend, Export, Print]} />
<StockChartSeriesCollectionDirective>
<StockChartSeriesDirective
dataSource={stockData}
type='Candle'
name='Apple Inc'
/>
</StockChartSeriesCollectionDirective>
</StockChartComponent>
);
}
Pattern 2: Candlestick with Bear/Bull Colors and Animation
function StyledCandleChart() {
const stockData = [ /* stock data with open, high, low, close */ ];
return (
<StockChartComponent
id='stockchart'
primaryXAxis={{ valueType: 'DateTime' }}
primaryYAxis={{ labelFormat: '${value}' }}
>
<Inject services={[DateTime, CandleSeries, Tooltip, RangeTooltip]} />
<StockChartSeriesCollectionDirective>
<StockChartSeriesDirective
dataSource={stockData}
type='Candle'
xName='x'
open='open'
high='high'
low='low'
close='close'
bearFillColor='#ef5350' // Red for downtrend
bullFillColor='#26a69a' // Green for uptrend
animation={{ enable: true, duration: 500 }}
/>
</StockChartSeriesCollectionDirective>
</StockChartComponent>
);
}
Pattern 3: Technical Analysis Chart
function TechnicalAnalysisChart() {
const indicators = [
{
type: 'Sma',
field: 'Close',
period: 14,
fill: 'blue'
},
{
type: 'BollingerBands',
field: 'Close',
period: 20,
standardDeviation: 2,
upperLine: { color: '#ff0000', width: 1 },
lowerLine: { color: '#ff0000', width: 1 }
}
];
return (
<StockChartComponent
id='stockchart'
primaryXAxis={{ valueType: 'DateTime' }}
indicators={indicators}
>
<Inject services={[DateTime, CandleSeries, Tooltip,
LineSeries, RangeTooltip, SmaIndicator, BollingerBands]} />
<StockChartSeriesCollectionDirective>
<StockChartSeriesDirective
dataSource={stockData}
type='Candle'
/>
</StockChartSeriesCollectionDirective>
<StockChartIndicatorsDirective>
{/* Indicators can also be added here via directives */}
</StockChartIndicatorsDirective>
</StockChartComponent>
);
}
Pattern 4: Crosshair with Axis Tooltips
function CrosshairChart() {
return (
<StockChartComponent
id='stockchart'
primaryXAxis={{
valueType: 'DateTime',
majorGridLines: { width: 0 },
majorTickLines: { color: 'transparent' },
crosshairTooltip: { enable: true } // X-axis tooltip
}}
primaryYAxis={{
labelFormat: 'n0',
majorTickLines: { width: 0 },
crosshairTooltip: { enable: true } // Y-axis tooltip
}}
crosshair={{
enable: true,
lineType: 'Both',
line: { width: 1, color: '#0080ff' }
}}
tooltip={{ enable: true }}
>
<Inject services={[DateTime, CandleSeries, Crosshair, Tooltip, RangeTooltip]} />
<StockChartSeriesCollectionDirective>
<StockChartSeriesDirective
dataSource={stockData}
type='Candle'
/>
</StockChartSeriesCollectionDirective>
</StockChartComponent>
);
}
Pattern 5: Stock Events Visualization
function StockEventsChart() {
const stockEvents = [
{
date: new Date('2012-04-01'),
text: 'Q1 Earnings',
description: 'Quarterly earnings release',
type: 'Flag',
background: '#6c757d'
},
{
date: new Date('2012-07-01'),
text: 'Dividend',
description: 'Dividend payout',
type: 'Circle',
background: '#28a745'
}
];
return (
<StockChartComponent
id='stockchart'
primaryXAxis={{ valueType: 'DateTime' }}
stockEvents={stockEvents}
>
<Inject services={[DateTime, SplineSeries, Tooltip]} />
<StockChartSeriesCollectionDirective>
<StockChartSeriesDirective
dataSource={stockData}
type='Spline'
/>
</StockChartSeriesCollectionDirective>
</StockChartComponent>
);
}
Pattern 6: Export and Print
function ExportableChart() {
const chartRef = useRef<StockChartComponent>(null);
const handleExport = (type: string) => {
if (chartRef.current) {
chartRef.current.export(type, 'StockChart');
}
};
const handlePrint = () => {
if (chartRef.current) {
chartRef.current.print();
}
};
return (
<div>
<div>
<button => handleExport('PNG')}>Export PNG</button>
<button => handleExport('JPEG')}>Export JPEG</button>
<button => handleExport('SVG')}>Export SVG</button>
<button => handleExport('PDF')}>Export PDF</button>
<button Chart</button>
</div>
<StockChartComponent
ref={chartRef}
id='stockchart'
primaryXAxis={{ valueType: 'DateTime' }}
exportType={['PNG', 'JPEG', 'SVG', 'PDF']}
>
<Inject services={[DateTime, CandleSeries, Export]} />
<StockChartSeriesCollectionDirective>
<StockChartSeriesDirective
dataSource={stockData}
type='Candle'
/>
</StockChartSeriesCollectionDirective>
</StockChartComponent>
</div>
);
}
Key Props
StockChartComponent
| Prop |
Type |
Description |
primaryXAxis |
Object |
X-axis configuration (typically DateTime) |
primaryYAxis |
Object |
Y-axis configuration |
axes |
Array |
Additional Y-axes for multi-axis scaling |
title |
string |
Chart title |
titleStyle |
Object |
Title font styling |
periods |
Array |
Period selector buttons configuration |
enablePeriodSelector |
boolean |
Show/hide period selector (default: true) |
enableSelector |
boolean |
Show/hide range selector (default: true) |
enableCustomRange |
boolean |
Enable custom date range selection |
tooltip |
Object |
Tooltip configuration |
crosshair |
Object |
Crosshair configuration |
legendSettings |
Object |
Legend configuration |
stockEvents |
Array |
Stock event markers |
indicators |
Array |
Technical indicators |
height |
string |
Chart height |
width |
string |
Chart width |
margin |
Object |
Chart margin configuration |
chartArea |
Object |
Chart area styling |
background |
string |
Chart background color |
border |
Object |
Chart border configuration |
theme |
string |
Chart theme |
zoomSettings |
Object |
Zoom and pan configuration |
rows |
Array |
Row definitions for multi-row layouts |
selectedDataIndexes |
Array |
Programmatically select specific points |
selectionMode |
string |
Selection mode (None, Point, Series, Cluster, DragXY, DragX, DragY) |
isMultiSelect |
boolean |
Allow multiple data point selection |
exportType |
Array |
Export formats (PNG, JPEG, SVG, PDF) |
enablePersistence |
boolean |
Persist chart state between page reloads |
enableRtl |
boolean |
Enable right-to-left rendering |
locale |
string |
Override global culture/localization |
noDataTemplate |
string/Function |
Template shown when no data available |
isTransposed |
boolean |
Render chart in transposed manner |
seriesType |
Array |
Available series types |
indicatorType |
Array |
Available technical indicator types |
trendlineType |
Array |
Available trendline types |
bearFillColor |
string |
Fill color for downtrend (bear) candles |
bullFillColor |
string |
Fill color for uptrend (bull) candles |
animation |
Object |
Animation settings for series rendering |
pointClick |
Function |
Event fired when a data point is clicked |
stockChartMouseMove |
Function |
Event fired when mouse moves over chart |
stockChartMouseClick |
Function |
Event fired when chart area is clicked |
stockChartMouseDown |
Function |
Event fired on mouse down |
stockChartMouseUp |
Function |
Event fired on mouse up |
stockChartMouseLeave |
Function |
Event fired when cursor leaves chart |
tooltipRender |
Function |
Event for customizing tooltip before display |
axisLabelRender |
Function |
Event for customizing axis labels before rendering |
seriesRender |
Function |
Event fired when series is rendered |
legendClick |
Function |
Event fired when legend item is clicked |
legendRender |
Function |
Event fired when legend items are rendered |
crosshairLabelRender |
Function |
Event fired before crosshair tooltip is rendered |
selectorRender |
Function |
Triggered when range selector renders |
onZooming |
Function |
Event fired during zoom interactions |
load |
Function |
Lifecycle event fired before chart is loaded |
loaded |
Function |
Lifecycle event fired after chart is loaded |
beforeExport |
Function |
Event fired before export operation |
stockEventRender |
Function |
Customize stock event marker rendering |
rows |
Array |
Row definitions for multi-row layouts |
isTransposed |
boolean |
Render chart in transposed manner |
trendlines |
Array |
Trend line configurations (StockChartTrendlinesDirective) |
StockChartSeriesDirective
| Prop |
Type |
Description |
dataSource |
Array |
Stock data array |
type |
string |
Series type (Candle, Line, Spline, Hilo, HiloOpenClose) |
xName |
string |
Data field for x-axis (date) |
high |
string |
Data field for high values |
low |
string |
Data field for low values |
open |
string |
Data field for open values |
close |
string |
Data field for close values |
volume |
string |
Data field for volume values |
name |
string |
Series name for legend |
yName |
string |
Data field for y-axis values |
yAxisName |
string |
Name of Y-axis to bind this series to (for multi-axis) |
bearFillColor |
string |
Fill color for downtrend candles/bars |
bullFillColor |
string |
Fill color for uptrend candles/bars |
fill |
string |
Series color or gradient fill (e.g., 'url(#gradient1)') |
width |
number |
Line width for series |
opacity |
number |
Opacity of series (0-1) |
border |
Object |
Border configuration for series (width, color, dashArray) |
marker |
Object |
Data point marker configuration (visible, size, shape, fill, border) |
animation |
Object |
Animation settings (enable, duration, delay) |
legendShape |
string |
Legend icon shape (Circle, Rectangle, Triangle, Diamond, etc.) |
tooltip |
Object |
Series-specific tooltip configuration |
trendlines |
Array |
Trend lines for this series |
cornerRadius |
number |
Corner radius for rectangular shapes |
Common Use Cases
- Stock Trading Platform - Display real-time or historical stock prices with candlestick charts
- Financial Analytics Dashboard - Multi-chart layout with technical indicators and events
- Portfolio Tracker - Visualize investment performance over time
- Market Research Tool - Compare multiple stocks with different series types
- Trading Algorithm Backtesting - Visualize strategy results with indicators and trend lines
- Economic Data Visualization - Display time-series financial or economic data
- Cryptocurrency Charts - Track crypto price movements with OHLC data
Module Injection
Stock Chart requires explicit module injection for features:
import { Inject, DateTime, DateTimeCategory, Logarithmic,
Tooltip, RangeTooltip, Crosshair,
LineSeries, SplineSeries, CandleSeries, HiloOpenCloseSeries,
HiloSeries, RangeAreaSeries, StockLegend, Trendlines, Export } from '@syncfusion/ej2-react-charts';
import { EmaIndicator, RsiIndicator, BollingerBands, TmaIndicator,
MomentumIndicator, SmaIndicator, AtrIndicator,
AccumulationDistributionIndicator, MacdIndicator,
StochasticIndicator } from '@syncfusion/ej2-react-charts';
<StockChartComponent>
<Inject services={[DateTime, Tooltip, RangeTooltip, Crosshair,
CandleSeries, StockLegend, Trendlines, Export,
EmaIndicator, SmaIndicator, BollingerBands]} />
</StockChartComponent>
Common modules:
Axes:
- DateTime - DateTime axis (required for stock charts)
- DateTimeCategory - DateTime category axis for business days only
- Logarithmic - Logarithmic scale axis
UI Features:
- Tooltip - Hover tooltips for data points
- RangeTooltip - Range selector tooltips
- Crosshair - Crosshair lines with axis tooltips
- StockLegend - Legend display for series
Series Types:
- LineSeries, SplineSeries - Line charts
- CandleSeries - Traditional candlestick chart
- HiloOpenCloseSeries - OHLC bars
- HiloSeries - High-Low bars
- RangeAreaSeries - Range area visualization
Technical Analysis:
- Trendlines - Trend line visualization (Linear, Exponential, Logarithmic, Polynomial, Power, Moving Average)
- EmaIndicator, SmaIndicator, TmaIndicator - Moving average indicators
- RsiIndicator, BollingerBands, MacdIndicator - Advanced indicators
- StochasticIndicator, MomentumIndicator, AtrIndicator - Momentum indicators
- AccumulationDistributionIndicator - Volume-based indicator
Export:
- Export - Export to PNG, JPEG, SVG, PDF
Event Handling
Stock Chart provides comprehensive event support for tracking user interactions and building custom behaviors:
Data Point Events
// Point click event
const handlePointClick = (args) => {
console.log('Point clicked:', args.pointIndex, args.seriesIndex);
console.log('X:', args.x, 'Y:', args.y);
};
// Point move event (hover)
const handlePointMove = (args) => {
console.log('Hovering over point:', args.x);
};
<StockChartComponent
pointClick={handlePointClick}
pointMove={handlePointMove}
>
{/* ... */}
</StockChartComponent>
Mouse Events
// Various mouse tracking events
const handleMouseMove = (args) => {
console.log('Mouse position:', args.x, args.y);
};
const handleMouseLeave = (args) => {
console.log('Mouse left chart area');
};
const handleMouseClick = (args) => {
console.log('Chart clicked');
};
<StockChartComponent
stockChartMouseMove={handleMouseMove}
stockChartMouseLeave={handleMouseLeave}
stockChartMouseClick={handleMouseClick}
stockChartMouseDown={(args) => console.log('Mouse down')}
stockChartMouseUp={(args) => console.log('Mouse up')}
>
{/* ... */}
</StockChartComponent>
Range and Selector Events
// Range change event (period selector or range selector)
const handleRangeChange = (args) => {
console.log('Range changed:', args.start, 'to', args.end);
// Refresh data or update analysis
};
<StockChartComponent
rangeChange={handleRangeChange}
>
{/* ... */}
</StockChartComponent>
Legend Events
// Legend click event
const handleLegendClick = (args) => {
console.log('Legend item clicked:', args.legendText);
};
// Legend render event (for customization)
const handleLegendRender = (args) => {
if (args.legendText === 'AAPL') {
args.fill = '#ff0000'; // Customize legend color
}
};
<StockChartComponent
legendClick={handleLegendClick}
legendRender={handleLegendRender}
>
{/* ... */}
</StockChartComponent>
Tooltip Events
// Customize tooltip before rendering
const handleTooltipRender = (args) => {
args.text = `<b>Stock Price: ${args.text}</b>`;
};
<StockChartComponent
tooltip={{ enable: true }}
tooltipRender={handleTooltipRender}
>
{/* ... */}
</StockChartComponent>
Stock Event Rendering
// Customize stock event markers
const handleStockEventRender = (args) => {
// Customize event styling, position, etc.
if (args.text === 'Earnings') {
args.background = '#ff0000'; // Custom color for earnings
}
};
<StockChartComponent
stockEvents={stockEvents}
stockEventRender={handleStockEventRender}
>
{/* ... */}
</StockChartComponent>
Lifecycle Events
// Load event (before rendering)
const handleLoad = (args) => {
console.log('Chart loading');
};
// Loaded event (after rendering)
const handleLoaded = (args) => {
console.log('Chart loaded');
};
<StockChartComponent
load={handleLoad}
loaded={handleLoaded}
>
{/* ... */}
</StockChartComponent>
API Reference
Below is a concise API reference derived from the official Syncfusion StockChart API. Include or expand these entries in references/* as needed.
Complete API Documentation:
Selected Props (StockChartComponent)
All props with official API links: https://ej2.syncfusion.com/react/documentation/api/stock-chart/stockChartModel
Data & Series:
Axes:
Navigation & Selectors:
Analysis & Events:
Interaction & UI:
Selection & Appearance:
Theming & Layout:
Export & Persistence:
…(truncated)
1---
2name: syncfusion-react-stock-chart
3description: Implements the Syncfusion React Stock Chart component for visualizing financial and market data. Use this when users need stock price visualization, OHLC charts, candlestick charts, or trading chart interfaces. Supports multiple series types, period selectors, range navigators, technical indicators (e.g., SMA, MACD, Bollinger Bands), and interactive analysis tools for financial data in React applications.
4metadata:
5 author: "Syncfusion Inc"
6 version: "34.1.29"
7 category: "Data Visualization"
8---
9
10# Implementing Syncfusion React Stock Charts
11
12The Stock Chart component is a specialized financial chart for visualizing stock price movements over time. It provides essential features for financial data analysis including candlestick/OHLC visualization, period selectors for quick date range navigation, range selectors for precise data filtering, technical indicators, and interactive tools like tooltips and crosshair.
13
14## When to Use This Skill
15
16Use this skill when you need to:
17
18- **Visualize financial/stock data** - Display stock prices, trading volumes, market movements
19- **Display OHLC data** - Show Open, High, Low, Close values with candlestick or Hilo charts
20- **Implement period navigation** - Add quick time range buttons (1D, 5D, 1M, 6M, YTD, 1Y, ALL)
21- **Enable range selection** - Allow users to select specific date ranges with thumb navigation
22- **Add technical analysis** - Include technical indicators (SMA, EMA, RSI, MACD, etc.)
23- **Show stock events** - Visualize earnings, dividends, splits, or other market events
24- **Create financial dashboards** - Build comprehensive stock analysis interfaces
25- **Display time-series data** - Any datetime-based financial or trading data
26
27## Component Overview
28
29**Package:** `@syncfusion/ej2-react-charts`
30**Component:** `StockChartComponent`
31**Key Features:**
32- 6 series types (Line, Spline, Hilo, HiloOpenClose, Candle, Hollow Candle)
33- Built-in period selector for quick date range navigation
34- Range navigator with thumb controls for precise selection
35- Technical indicators (20+ types) and `indicatorType` support
36- Stock event annotations (`stockEvents`) and `stockEventRender`
37- Interactive tooltip, crosshair (trackball), and legend
38- Selection and interaction: `selectionMode`, `isMultiSelect`, `selectedDataIndexes`
39- Zooming and panning (`zoomSettings`, `onZooming`)
40- Export to image/PDF and print capabilities (`exportType`, `Export`, `Print`)
41- Persistence and RTL support (`enablePersistence`, `enableRtl`)
42- Responsive and accessible (WCAG, ARIA, keyboard navigation)
43
44## Documentation and Navigation Guide
45
46### Getting Started
47📄 **Read:** [references/getting-started.md](references/getting-started.md)
48
49Read this first for initial setup:
50- Installing @syncfusion/ej2-react-charts package
51- Project setup with Vite or create-react-app
52- Basic StockChartComponent implementation
53- Module injection pattern (Inject services)
54- Creating first chart with sample data
55- Understanding data structure (x, open, high, low, close, volume)
56- Adding chart title and basic configuration
57
58### Axis Types and Configuration
59📄 **Read:** [references/configuration.md](references/configuration.md)
60
61For configuring and customizing axes:
62- **DateTime Axis** - Date/time based x-axis (most common for stock charts)
63- **DateTimeCategory Axis** - Business days only (excludes weekends/holidays)
64- **Logarithmic Axis** - Logarithmic scale for wide value ranges
65- **Numeric Axis** - Standard numeric axis for y-values
66- Axis title, labels, and formatting
67- Grid lines and tick customization
68- Multiple Y-axes for different data scales
69- Axis ranges and padding settings
70
71### Series Types and Visualization
72📄 **Read:** [references/series-types.md](references/series-types.md)
73
74For choosing and configuring chart series:
75- **Line series** - Continuous price lines
76- **Spline series** - Smooth curves
77- **Hilo series** - High-low range bars
78- **HiloOpenClose series** - OHLC bars
79- **Candle series** - Traditional candlesticks (default for stock charts)
80- **Hollow Candle series** - Filled/hollow based on price movement
81- Bear/Bull fill colors for candlesticks
82- Series dropdown navigation and type switching
83- Module injection for each series type
84- When to use each type
85
86### Period and Range Selectors
87📄 **Read:** [references/selectors.md](references/selectors.md)
88
89For implementing time range navigation:
90- **Period Selector:** Quick navigation buttons (1D, 5D, 1M, etc.)
91 - Periods array configuration (interval, text, intervalType)
92 - IntervalType options (Years, Months, Weeks, Days, Hours, etc.)
93 - Enabling/disabling period selector
94- **Range Selector:** Precise range selection with thumbs
95 - Thumb navigation and dragging
96 - Label tapping for range selection
97 - Date range button integration
98 - Enabling/disabling range selector
99
100### Interactive Features and Events
101📄 **Read:** [references/interactive-features.md](references/interactive-features.md)
102
103For adding user interaction and visual feedback:
104- **Legend:** Display series information
105 - Position and alignment options (Top, Bottom, Left, Right, Custom)
106 - Customization (size, shape, colors, icons)
107 - Legend title and template
108 - Legend click/render events
109- **Tooltip:** Show point data on hover
110 - Format customization with tokens (${point.x}, ${point.open}, etc.)
111 - Position control (Auto, Nearest)
112 - Appearance styling (fill, border, textStyle)
113 - Shared tooltips for multi-series
114 - Header and custom formatting
115- **Crosshair:** Vertical/horizontal lines for precise value reading
116 - Crosshair tooltip for axis values on both axes
117 - Line customization (width, color, dashArray)
118 - Snap to data for cleaner interactions
119 - Trackball mode for shared tooltip across series
120 - Line type (Both, Vertical, Horizontal)
121- **Mouse Events:** Comprehensive interaction tracking
122 - pointClick, pointMove for data point interactions
123 - stockChartMouseMove, stockChartMouseClick, etc.
124 - stockChartMouseLeave for UI cleanup
125 - Range change events for selector updates
126
127### Technical Analysis Tools
128📄 **Read:** [references/technical-analysis.md](references/technical-analysis.md)
129
130For financial analysis features:
131- **Stock Events:** Annotate significant market events
132 - Event types (Flag, Circle, Square, Triangle, etc.)
133 - Event markers with customizable colors and shapes
134 - Event descriptions and tooltips
135 - Events for specific series targeting
136 - stockEventRender event for custom styling
137 - Event visibility control
138- **Technical Indicators:** Add analysis overlays
139 - 10+ indicator types:
140 - Moving averages: SMA, EMA, TMA
141 - Momentum: RSI, MACD, Stochastic, Momentum
142 - Volume: Accumulation Distribution, ATR
143 - Advanced: Bollinger Bands
144 - Indicator configuration and styling
145 - Multiple indicators on one chart
146 - Field selection (Open, High, Low, Close)
147 - Period and standard deviation customization
148- **Trend Lines:** Draw trend analysis lines
149 - 6 trendline types: Linear, Exponential, Logarithmic, Polynomial, Power, MovingAverage
150 - Line configuration (start/end points, series binding)
151 - Styling and customization (color, width, dashArray)
152 - Multiple trend lines per series
153 - Polynomial order customization
154 - Moving average period configuration
155
156### Tooltip, Crosshair, and Axis Configuration
157📄 **Read:** [references/interactive-features.md](references/interactive-features.md) and [references/configuration.md](references/configuration.md)
158
159For tooltip and crosshair setup:
160- **Tooltip Configuration:** Point hover information
161 - Enable/disable with `enable` property
162 - Format strings for OHLC data display
163 - Background color and border styling
164 - Text style customization
165 - Position modes (Auto, Nearest)
166- **Crosshair Lines:** Precise value reading
167 - Enable crosshair with `enable: true`
168 - Line type: Both, Vertical, or Horizontal
169 - Line customization (width, color, dashArray)
170 - Snap to data point alignment
171 - Crosshair line styling
172- **Axis Tooltips:** Display axis values
173 - Enable on primaryXAxis via `crosshairTooltip`
174 - Enable on primaryYAxis via `crosshairTooltip`
175 - Fill color and text style customization
176 - Format axis value display
177
178### Chart Configuration and Styling
179📄 **Read:** [references/configuration.md](references/configuration.md)
180
181For customizing chart appearance and behavior:
182- **Axes Configuration:** Setup X and Y axes
183 - Axis types: DateTime (default), DateTimeCategory, Logarithmic, Numeric
184 - Label formatting and intervals
185 - Multiple axes support with `axes` array
186 - Axis ranges, padding, and grid lines
187 - Major/minor tick and grid customization
188- **Chart Dimensions:** Control size
189 - Width and height properties (pixels or percentage)
190 - Responsive sizing strategies
191 - Container-based sizing
192- **Appearance:** Theme and styling
193 - Built-in themes (Material, Fabric, Bootstrap, HighContrast, etc.)
194 - Background and border customization
195 - Chart area styling
196 - Margin and padding configuration
197 - Title and title styling
198- **Gradient Fills:** Advanced styling
199 - Linear gradients (x1, y1, x2, y2 stops)
200 - Radial gradients (cx, cy, r stops)
201 - Gradient for series fill
202 - SVG gradient definitions
203
204### Export, Print, and Accessibility
205📄 **Read:** [references/utilities.md](references/utilities.md)
206
207For export functionality and accessibility:
208- **Export:** Save charts as files
209 - Export as PNG, JPEG, SVG
210 - Export as PDF
211 - Configuration options
212- **Print:** Print chart directly
213 - Print method and options
214- **Accessibility:** WCAG compliance
215 - Keyboard navigation
216 - ARIA attributes
217 - Screen reader support
218 - Accessible color schemes
219
220## Quick Start
221
222### Basic Stock Chart
223
224```typescript
225import { StockChartComponent, StockChartSeriesCollectionDirective,
226 StockChartSeriesDirective, Inject, DateTime, Tooltip,
227 RangeTooltip, Crosshair, LineSeries, SplineSeries,
228 CandleSeries, HiloOpenCloseSeries, HiloSeries,
229 RangeAreaSeries, Trendlines } from '@syncfusion/ej2-react-charts';
230import * as React from 'react';
231
232function App() {
233 const data = [
234 { x: new Date('2012-04-02'), open: 85.97, high: 90.58, low: 85.97, close: 90.58, volume: 660187068 },
235 { x: new Date('2012-04-09'), open: 89.02, high: 92.50, low: 88.50, close: 92.90, volume: 490033264 },
236 { x: new Date('2012-04-16'), open: 92.52, high: 93.00, low: 88.50, close: 92.52, volume: 450167016 },
237 // ... more data
238 ];
239
240 return (
241 <StockChartComponent
242 id='stockchart'
243 title='AAPL Stock Price'
244 primaryXAxis={{ valueType: 'DateTime' }}
245 >
246 <Inject services={[DateTime, Tooltip, RangeTooltip, Crosshair, LineSeries,
247 SplineSeries, CandleSeries, HiloOpenCloseSeries, HiloSeries,
248 RangeAreaSeries, Trendlines]} />
249 <StockChartSeriesCollectionDirective>
250 <StockChartSeriesDirective
251 dataSource={data}
252 type='Candle'
253 xName='x'
254 high='high'
255 low='low'
256 open='open'
257 close='close'
258 volume='volume'
259 />
260 </StockChartSeriesCollectionDirective>
261 </StockChartComponent>
262 );
263}
264
265export default App;
266```
267
268### Stock Chart with Period Selector
269
270```typescript
271import { StockChartComponent, StockChartSeriesCollectionDirective,
272 StockChartSeriesDirective, Inject, DateTime, Tooltip,
273 RangeTooltip, Crosshair, CandleSeries } from '@syncfusion/ej2-react-charts';
274
275function App() {
276 const data = [ /* stock data */ ];
277
278 const periods = [
279 { intervalType: 'Days', interval: 1, text: '1D' },
280 { intervalType: 'Days', interval: 5, text: '5D' },
281 { intervalType: 'Months', interval: 1, text: '1M' },
282 { intervalType: 'Months', interval: 3, text: '3M' },
283 { intervalType: 'Months', interval: 6, text: '6M' },
284 { intervalType: 'Years', interval: 1, text: '1Y' },
285 { text: 'All' }
286 ];
287
288 return (
289 <StockChartComponent
290 id='stockchart'
291 title='Stock Analysis'
292 primaryXAxis={{ valueType: 'DateTime' }}
293 periods={periods}
294 enablePeriodSelector={true}
295 >
296 <Inject services={[DateTime, Tooltip, RangeTooltip, Crosshair, CandleSeries]} />
297 <StockChartSeriesCollectionDirective>
298 <StockChartSeriesDirective
299 dataSource={data}
300 type='Candle'
301 xName='x'
302 high='high'
303 low='low'
304 open='open'
305 close='close'
306 />
307 </StockChartSeriesCollectionDirective>
308 </StockChartComponent>
309 );
310}
311```
312
313## CSS Styling for Stock Chart
314
315For the Stock Chart period selector UI to work properly, you need to include the required CSS stylesheets in your HTML file. Add the following `<link>` tags to the `<head>` section of your `index.html`:
316
317```html
318<!DOCTYPE html>
319<html lang="en">
320 <head>
321 <meta charset="UTF-8" />
322 <link rel="icon" type="image/svg+xml" href="/vite.svg" />
323 <meta name="viewport" content="width=device-width, initial-scale=1.0" />
324
325 <!-- Syncfusion Tailwind CSS for Stock Chart styling -->
326 <link href="https://cdn.syncfusion.com/ej2/33.1.44/tailwind3.css" rel="stylesheet" />
327
328 <!-- Bootstrap CSS for additional styling support -->
329 <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
330
331 <title>Stock Chart App</title>
332 </head>
333 <body>
334 <div id="root"></div>
335 <script type="module" src="/src/main.tsx"></script>
336 </body>
337</html>
338```
339
340**Key CSS Stylesheets:**
341
3421. **Syncfusion Tailwind CSS** (`tailwind3.css`) - Required for Stock Chart components
343 - Version: 33.1.44 (update to match your Syncfusion version)
344 - Provides styling for period selector buttons, range navigator, tooltips, and other UI elements
345 - CDN URL: `https://cdn.syncfusion.com/ej2/33.1.44/tailwind3.css`
346
3472. **Bootstrap CSS** - Optional but recommended for additional styling support
348 - Version: 3.3.7
349 - Provides base styling and layout utilities
350 - CDN URL: `https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css`
351
352**Important Notes:**
353- Ensure the Syncfusion CSS version matches your `@syncfusion/ej2-react-charts` package version
354- If you're using a different theme (Material, Bootstrap, Fabric, HighContrast), use the corresponding CSS file from Syncfusion CDN
355- Place these stylesheets before other custom stylesheets to allow proper CSS cascade and overrides
356- Without these stylesheets, the period selector buttons, tooltips, and other UI elements may not render correctly
357
358**Alternative CSS URLs by Theme:**
359- Material: `https://cdn.syncfusion.com/ej2/33.1.44/material.css`
360- Bootstrap: `https://cdn.syncfusion.com/ej2/33.1.44/bootstrap.css`
361- Fabric: `https://cdn.syncfusion.com/ej2/33.1.44/fabric.css`
362- Tailwind: `https://cdn.syncfusion.com/ej2/33.1.44/tailwind3.css`
363- HighContrast: `https://cdn.syncfusion.com/ej2/33.1.44/highcontrast.css`
364
365## Axis Types Reference
366
367Stock Chart supports multiple axis types for different data scenarios:
368
369### DateTime Axis (Default)
370Use for date-based stock data:
371```typescript
372primaryXAxis={{
373 valueType: 'DateTime',
374 majorGridLines: { width: 0 },
375 majorTickLines: { color: 'transparent' }
376}}
377```
378**Best for:** Stock price data with dates
379**Inject:** `DateTime` module
380
381### DateTimeCategory Axis
382Displays only business days (excludes weekends/holidays):
383```typescript
384primaryXAxis={{
385 valueType: 'DateTimeCategory',
386 majorGridLines: { width: 0 }
387}}
388```
389**Best for:** Business day-only trading data
390**Inject:** `DateTimeCategory` module
391**Note:** Requires `DateTimeCategory` module import and injection
392
393### Logarithmic Axis
394For Y-axis with logarithmic scale (useful for wide value ranges):
395```typescript
396primaryYAxis={{
397 valueType: 'Logarithmic',
398 labelFormat: '${value}'
399}}
400```
401**Best for:** Data spanning multiple orders of magnitude
402**Inject:** `Logarithmic` module
403**Note:** Cannot contain zero or negative values
404
405### Numeric Axis (Y-axis default)
406Standard linear numeric scale:
407```typescript
408primaryYAxis={{
409 valueType: 'Double',
410 labelFormat: '${value}',
411 minimum: 0,
412 maximum: 500,
413 interval: 50
414}}
415```
416**Best for:** Price values and general Y-axis
417**No module injection required** - This is the default
418
419### Multi-Axis Configuration
420Use multiple Y-axes for different scales:
421```typescript
422<StockChartComponent
423 primaryXAxis={{ valueType: 'DateTime' }}
424 primaryYAxis={{ title: 'Price', labelFormat: '${value}' }}
425>
426 {/* Additional axes using StockChartAxesDirective */}
427 <StockChartAxesDirective>
428 <StockChartAxisDirective
429 name='volumeAxis'
430 opposedPosition={true}
431 title='Volume'
432 labelFormat='{value}M'
433 />
434 </StockChartAxesDirective>
435
436 {/* Series bind to respective axes */}
437 <StockChartSeriesCollectionDirective>
438 <StockChartSeriesDirective type='Candle' yAxisName='primaryYAxis' />
439 <StockChartSeriesDirective type='Column' yAxisName='volumeAxis' />
440 </StockChartSeriesCollectionDirective>
441</StockChartComponent>
442```
443
444## Common Patterns
445
446### Pattern 1: Financial Dashboard with Multiple Features
447
448```typescript
449import { StockChartComponent, StockChartSeriesCollectionDirective,
450 StockChartSeriesDirective, Inject, DateTime, Tooltip,
451 RangeTooltip, Crosshair, CandleSeries, StockLegend,
452 Export, Print } from '@syncfusion/ej2-react-charts';
453
454function FinancialDashboard() {
455 const handlePointClick = (args) => {
456 console.log(`Point clicked: ${args.x}, Value: ${args.y}`);
457 };
458
459 const handleMouseMove = (args) => {
460 console.log('Mouse moved over chart');
461 };
462
463 const handleRangeChange = (args) => {
464 console.log(`Range changed: ${args.start} to ${args.end}`);
465 };
466
467 return (
468 <StockChartComponent
469 id='stockchart'
470 title='Comprehensive Stock Analysis'
471 primaryXAxis={{ valueType: 'DateTime' }}
472 tooltip={{ enable: true, shared: true }}
473 crosshair={{ enable: true }}
474 legendSettings={{ visible: true }}
475 enablePeriodSelector={true}
476 enableSelector={true}
477 pointClick={handlePointClick}
478 stockChartMouseMove={handleMouseMove}
479 rangeChange={handleRangeChange}
480 >
481 <Inject services={[DateTime, Tooltip, RangeTooltip, Crosshair,
482 CandleSeries, StockLegend, Export, Print]} />
483 <StockChartSeriesCollectionDirective>
484 <StockChartSeriesDirective
485 dataSource={stockData}
486 type='Candle'
487 name='Apple Inc'
488 />
489 </StockChartSeriesCollectionDirective>
490 </StockChartComponent>
491 );
492}
493```
494
495### Pattern 2: Candlestick with Bear/Bull Colors and Animation
496
497```typescript
498function StyledCandleChart() {
499 const stockData = [ /* stock data with open, high, low, close */ ];
500
501 return (
502 <StockChartComponent
503 id='stockchart'
504 primaryXAxis={{ valueType: 'DateTime' }}
505 primaryYAxis={{ labelFormat: '${value}' }}
506 >
507 <Inject services={[DateTime, CandleSeries, Tooltip, RangeTooltip]} />
508 <StockChartSeriesCollectionDirective>
509 <StockChartSeriesDirective
510 dataSource={stockData}
511 type='Candle'
512 xName='x'
513 open='open'
514 high='high'
515 low='low'
516 close='close'
517 bearFillColor='#ef5350' // Red for downtrend
518 bullFillColor='#26a69a' // Green for uptrend
519 animation={{ enable: true, duration: 500 }}
520 />
521 </StockChartSeriesCollectionDirective>
522 </StockChartComponent>
523 );
524}
525```
526
527### Pattern 3: Technical Analysis Chart
528
529```typescript
530function TechnicalAnalysisChart() {
531 const indicators = [
532 {
533 type: 'Sma',
534 field: 'Close',
535 period: 14,
536 fill: 'blue'
537 },
538 {
539 type: 'BollingerBands',
540 field: 'Close',
541 period: 20,
542 standardDeviation: 2,
543 upperLine: { color: '#ff0000', width: 1 },
544 lowerLine: { color: '#ff0000', width: 1 }
545 }
546 ];
547
548 return (
549 <StockChartComponent
550 id='stockchart'
551 primaryXAxis={{ valueType: 'DateTime' }}
552 indicators={indicators}
553 >
554 <Inject services={[DateTime, CandleSeries, Tooltip,
555 LineSeries, RangeTooltip, SmaIndicator, BollingerBands]} />
556 <StockChartSeriesCollectionDirective>
557 <StockChartSeriesDirective
558 dataSource={stockData}
559 type='Candle'
560 />
561 </StockChartSeriesCollectionDirective>
562 <StockChartIndicatorsDirective>
563 {/* Indicators can also be added here via directives */}
564 </StockChartIndicatorsDirective>
565 </StockChartComponent>
566 );
567}
568```
569
570### Pattern 4: Crosshair with Axis Tooltips
571
572```typescript
573function CrosshairChart() {
574 return (
575 <StockChartComponent
576 id='stockchart'
577 primaryXAxis={{
578 valueType: 'DateTime',
579 majorGridLines: { width: 0 },
580 majorTickLines: { color: 'transparent' },
581 crosshairTooltip: { enable: true } // X-axis tooltip
582 }}
583 primaryYAxis={{
584 labelFormat: 'n0',
585 majorTickLines: { width: 0 },
586 crosshairTooltip: { enable: true } // Y-axis tooltip
587 }}
588 crosshair={{
589 enable: true,
590 lineType: 'Both',
591 line: { width: 1, color: '#0080ff' }
592 }}
593 tooltip={{ enable: true }}
594 >
595 <Inject services={[DateTime, CandleSeries, Crosshair, Tooltip, RangeTooltip]} />
596 <StockChartSeriesCollectionDirective>
597 <StockChartSeriesDirective
598 dataSource={stockData}
599 type='Candle'
600 />
601 </StockChartSeriesCollectionDirective>
602 </StockChartComponent>
603 );
604}
605```
606
607### Pattern 5: Stock Events Visualization
608
609```typescript
610function StockEventsChart() {
611 const stockEvents = [
612 {
613 date: new Date('2012-04-01'),
614 text: 'Q1 Earnings',
615 description: 'Quarterly earnings release',
616 type: 'Flag',
617 background: '#6c757d'
618 },
619 {
620 date: new Date('2012-07-01'),
621 text: 'Dividend',
622 description: 'Dividend payout',
623 type: 'Circle',
624 background: '#28a745'
625 }
626 ];
627
628 return (
629 <StockChartComponent
630 id='stockchart'
631 primaryXAxis={{ valueType: 'DateTime' }}
632 stockEvents={stockEvents}
633 >
634 <Inject services={[DateTime, SplineSeries, Tooltip]} />
635 <StockChartSeriesCollectionDirective>
636 <StockChartSeriesDirective
637 dataSource={stockData}
638 type='Spline'
639 />
640 </StockChartSeriesCollectionDirective>
641 </StockChartComponent>
642 );
643}
644```
645
646### Pattern 6: Export and Print
647
648```typescript
649function ExportableChart() {
650 const chartRef = useRef<StockChartComponent>(null);
651
652 const handleExport = (type: string) => {
653 if (chartRef.current) {
654 chartRef.current.export(type, 'StockChart');
655 }
656 };
657
658 const handlePrint = () => {
659 if (chartRef.current) {
660 chartRef.current.print();
661 }
662 };
663
664 return (
665 <div>
666 <div>
667 <button onClick={() => handleExport('PNG')}>Export PNG</button>
668 <button onClick={() => handleExport('JPEG')}>Export JPEG</button>
669 <button onClick={() => handleExport('SVG')}>Export SVG</button>
670 <button onClick={() => handleExport('PDF')}>Export PDF</button>
671 <button onClick={handlePrint}>Print Chart</button>
672 </div>
673
674 <StockChartComponent
675 ref={chartRef}
676 id='stockchart'
677 primaryXAxis={{ valueType: 'DateTime' }}
678 exportType={['PNG', 'JPEG', 'SVG', 'PDF']}
679 >
680 <Inject services={[DateTime, CandleSeries, Export]} />
681 <StockChartSeriesCollectionDirective>
682 <StockChartSeriesDirective
683 dataSource={stockData}
684 type='Candle'
685 />
686 </StockChartSeriesCollectionDirective>
687 </StockChartComponent>
688 </div>
689 );
690}
691```
692
693## Key Props
694
695### StockChartComponent
696
697| Prop | Type | Description |
698|------|------|-------------|
699| `primaryXAxis` | Object | X-axis configuration (typically DateTime) |
700| `primaryYAxis` | Object | Y-axis configuration |
701| `axes` | Array | Additional Y-axes for multi-axis scaling |
702| `title` | string | Chart title |
703| `titleStyle` | Object | Title font styling |
704| `periods` | Array | Period selector buttons configuration |
705| `enablePeriodSelector` | boolean | Show/hide period selector (default: true) |
706| `enableSelector` | boolean | Show/hide range selector (default: true) |
707| `enableCustomRange` | boolean | Enable custom date range selection |
708| `tooltip` | Object | Tooltip configuration |
709| `crosshair` | Object | Crosshair configuration |
710| `legendSettings` | Object | Legend configuration |
711| `stockEvents` | Array | Stock event markers |
712| `indicators` | Array | Technical indicators |
713| `height` | string | Chart height |
714| `width` | string | Chart width |
715| `margin` | Object | Chart margin configuration |
716| `chartArea` | Object | Chart area styling |
717| `background` | string | Chart background color |
718| `border` | Object | Chart border configuration |
719| `theme` | string | Chart theme |
720| `zoomSettings` | Object | Zoom and pan configuration |
721| `rows` | Array | Row definitions for multi-row layouts |
722| `selectedDataIndexes` | Array | Programmatically select specific points |
723| `selectionMode` | string | Selection mode (None, Point, Series, Cluster, DragXY, DragX, DragY) |
724| `isMultiSelect` | boolean | Allow multiple data point selection |
725| `exportType` | Array | Export formats (PNG, JPEG, SVG, PDF) |
726| `enablePersistence` | boolean | Persist chart state between page reloads |
727| `enableRtl` | boolean | Enable right-to-left rendering |
728| `locale` | string | Override global culture/localization |
729| `noDataTemplate` | string/Function | Template shown when no data available |
730| `isTransposed` | boolean | Render chart in transposed manner |
731| `seriesType` | Array | Available series types |
732| `indicatorType` | Array | Available technical indicator types |
733| `trendlineType` | Array | Available trendline types |
734| `bearFillColor` | string | Fill color for downtrend (bear) candles |
735| `bullFillColor` | string | Fill color for uptrend (bull) candles |
736| `animation` | Object | Animation settings for series rendering |
737| `pointClick` | Function | Event fired when a data point is clicked |
738| `stockChartMouseMove` | Function | Event fired when mouse moves over chart |
739| `stockChartMouseClick` | Function | Event fired when chart area is clicked |
740| `stockChartMouseDown` | Function | Event fired on mouse down |
741| `stockChartMouseUp` | Function | Event fired on mouse up |
742| `stockChartMouseLeave` | Function | Event fired when cursor leaves chart |
743| `tooltipRender` | Function | Event for customizing tooltip before display |
744| `axisLabelRender` | Function | Event for customizing axis labels before rendering |
745| `seriesRender` | Function | Event fired when series is rendered |
746| `legendClick` | Function | Event fired when legend item is clicked |
747| `legendRender` | Function | Event fired when legend items are rendered |
748| `crosshairLabelRender` | Function | Event fired before crosshair tooltip is rendered |
749| `selectorRender` | Function | Triggered when range selector renders |
750| `onZooming` | Function | Event fired during zoom interactions |
751| `load` | Function | Lifecycle event fired before chart is loaded |
752| `loaded` | Function | Lifecycle event fired after chart is loaded |
753| `beforeExport` | Function | Event fired before export operation |
754| `stockEventRender` | Function | Customize stock event marker rendering |
755| `rows` | Array | Row definitions for multi-row layouts |
756| `isTransposed` | boolean | Render chart in transposed manner |
757| `trendlines` | Array | Trend line configurations (StockChartTrendlinesDirective) |
758
759### StockChartSeriesDirective
760
761| Prop | Type | Description |
762|------|------|-------------|
763| `dataSource` | Array | Stock data array |
764| `type` | string | Series type (Candle, Line, Spline, Hilo, HiloOpenClose) |
765| `xName` | string | Data field for x-axis (date) |
766| `high` | string | Data field for high values |
767| `low` | string | Data field for low values |
768| `open` | string | Data field for open values |
769| `close` | string | Data field for close values |
770| `volume` | string | Data field for volume values |
771| `name` | string | Series name for legend |
772| `yName` | string | Data field for y-axis values |
773| `yAxisName` | string | Name of Y-axis to bind this series to (for multi-axis) |
774| `bearFillColor` | string | Fill color for downtrend candles/bars |
775| `bullFillColor` | string | Fill color for uptrend candles/bars |
776| `fill` | string | Series color or gradient fill (e.g., 'url(#gradient1)') |
777| `width` | number | Line width for series |
778| `opacity` | number | Opacity of series (0-1) |
779| `border` | Object | Border configuration for series (width, color, dashArray) |
780| `marker` | Object | Data point marker configuration (visible, size, shape, fill, border) |
781| `animation` | Object | Animation settings (enable, duration, delay) |
782| `legendShape` | string | Legend icon shape (Circle, Rectangle, Triangle, Diamond, etc.) |
783| `tooltip` | Object | Series-specific tooltip configuration |
784| `trendlines` | Array | Trend lines for this series |
785| `cornerRadius` | number | Corner radius for rectangular shapes |
786
787## Common Use Cases
788
7891. **Stock Trading Platform** - Display real-time or historical stock prices with candlestick charts
7902. **Financial Analytics Dashboard** - Multi-chart layout with technical indicators and events
7913. **Portfolio Tracker** - Visualize investment performance over time
7924. **Market Research Tool** - Compare multiple stocks with different series types
7935. **Trading Algorithm Backtesting** - Visualize strategy results with indicators and trend lines
7946. **Economic Data Visualization** - Display time-series financial or economic data
7957. **Cryptocurrency Charts** - Track crypto price movements with OHLC data
796
797## Module Injection
798
799Stock Chart requires explicit module injection for features:
800
801```typescript
802import { Inject, DateTime, DateTimeCategory, Logarithmic,
803 Tooltip, RangeTooltip, Crosshair,
804 LineSeries, SplineSeries, CandleSeries, HiloOpenCloseSeries,
805 HiloSeries, RangeAreaSeries, StockLegend, Trendlines, Export } from '@syncfusion/ej2-react-charts';
806import { EmaIndicator, RsiIndicator, BollingerBands, TmaIndicator,
807 MomentumIndicator, SmaIndicator, AtrIndicator,
808 AccumulationDistributionIndicator, MacdIndicator,
809 StochasticIndicator } from '@syncfusion/ej2-react-charts';
810
811<StockChartComponent>
812 <Inject services={[DateTime, Tooltip, RangeTooltip, Crosshair,
813 CandleSeries, StockLegend, Trendlines, Export,
814 EmaIndicator, SmaIndicator, BollingerBands]} />
815</StockChartComponent>
816```
817
818**Common modules:**
819
820**Axes:**
821- **DateTime** - DateTime axis (required for stock charts)
822- **DateTimeCategory** - DateTime category axis for business days only
823- **Logarithmic** - Logarithmic scale axis
824
825**UI Features:**
826- **Tooltip** - Hover tooltips for data points
827- **RangeTooltip** - Range selector tooltips
828- **Crosshair** - Crosshair lines with axis tooltips
829- **StockLegend** - Legend display for series
830
831**Series Types:**
832- **LineSeries, SplineSeries** - Line charts
833- **CandleSeries** - Traditional candlestick chart
834- **HiloOpenCloseSeries** - OHLC bars
835- **HiloSeries** - High-Low bars
836- **RangeAreaSeries** - Range area visualization
837
838**Technical Analysis:**
839- **Trendlines** - Trend line visualization (Linear, Exponential, Logarithmic, Polynomial, Power, Moving Average)
840- **EmaIndicator, SmaIndicator, TmaIndicator** - Moving average indicators
841- **RsiIndicator, BollingerBands, MacdIndicator** - Advanced indicators
842- **StochasticIndicator, MomentumIndicator, AtrIndicator** - Momentum indicators
843- **AccumulationDistributionIndicator** - Volume-based indicator
844
845**Export:**
846- **Export** - Export to PNG, JPEG, SVG, PDF
847
848## Event Handling
849
850Stock Chart provides comprehensive event support for tracking user interactions and building custom behaviors:
851
852### Data Point Events
853
854```typescript
855// Point click event
856const handlePointClick = (args) => {
857 console.log('Point clicked:', args.pointIndex, args.seriesIndex);
858 console.log('X:', args.x, 'Y:', args.y);
859};
860
861// Point move event (hover)
862const handlePointMove = (args) => {
863 console.log('Hovering over point:', args.x);
864};
865
866<StockChartComponent
867 pointClick={handlePointClick}
868 pointMove={handlePointMove}
869>
870 {/* ... */}
871</StockChartComponent>
872```
873
874### Mouse Events
875
876```typescript
877// Various mouse tracking events
878const handleMouseMove = (args) => {
879 console.log('Mouse position:', args.x, args.y);
880};
881
882const handleMouseLeave = (args) => {
883 console.log('Mouse left chart area');
884};
885
886const handleMouseClick = (args) => {
887 console.log('Chart clicked');
888};
889
890<StockChartComponent
891 stockChartMouseMove={handleMouseMove}
892 stockChartMouseLeave={handleMouseLeave}
893 stockChartMouseClick={handleMouseClick}
894 stockChartMouseDown={(args) => console.log('Mouse down')}
895 stockChartMouseUp={(args) => console.log('Mouse up')}
896>
897 {/* ... */}
898</StockChartComponent>
899```
900
901### Range and Selector Events
902
903```typescript
904// Range change event (period selector or range selector)
905const handleRangeChange = (args) => {
906 console.log('Range changed:', args.start, 'to', args.end);
907 // Refresh data or update analysis
908};
909
910<StockChartComponent
911 rangeChange={handleRangeChange}
912>
913 {/* ... */}
914</StockChartComponent>
915```
916
917### Legend Events
918
919```typescript
920// Legend click event
921const handleLegendClick = (args) => {
922 console.log('Legend item clicked:', args.legendText);
923};
924
925// Legend render event (for customization)
926const handleLegendRender = (args) => {
927 if (args.legendText === 'AAPL') {
928 args.fill = '#ff0000'; // Customize legend color
929 }
930};
931
932<StockChartComponent
933 legendClick={handleLegendClick}
934 legendRender={handleLegendRender}
935>
936 {/* ... */}
937</StockChartComponent>
938```
939
940### Tooltip Events
941
942```typescript
943// Customize tooltip before rendering
944const handleTooltipRender = (args) => {
945 args.text = `<b>Stock Price: ${args.text}</b>`;
946};
947
948<StockChartComponent
949 tooltip={{ enable: true }}
950 tooltipRender={handleTooltipRender}
951>
952 {/* ... */}
953</StockChartComponent>
954```
955
956### Stock Event Rendering
957
958```typescript
959// Customize stock event markers
960const handleStockEventRender = (args) => {
961 // Customize event styling, position, etc.
962 if (args.text === 'Earnings') {
963 args.background = '#ff0000'; // Custom color for earnings
964 }
965};
966
967<StockChartComponent
968 stockEvents={stockEvents}
969 stockEventRender={handleStockEventRender}
970>
971 {/* ... */}
972</StockChartComponent>
973```
974
975### Lifecycle Events
976
977```typescript
978// Load event (before rendering)
979const handleLoad = (args) => {
980 console.log('Chart loading');
981};
982
983// Loaded event (after rendering)
984const handleLoaded = (args) => {
985 console.log('Chart loaded');
986};
987
988<StockChartComponent
989 load={handleLoad}
990 loaded={handleLoaded}
991>
992 {/* ... */}
993</StockChartComponent>
994```
995
996## API Reference
997
998Below is a concise API reference derived from the official Syncfusion `StockChart` API. Include or expand these entries in `references/*` as needed.
999
1000**Complete API Documentation:**
1001- **Full Comprehensive API Reference:** [references/complete-api-reference.md](references/complete-api-reference.md) - Master reference with all props, methods, events, directives, and modules
1002- **Concise API Summary:** [references/api.md](references/api.md) - Quick reference for commonly used APIs
1003- **Official Syncfusion Docs:** https://ej2.syncfusion.com/react/documentation/api/stock-chart/index-default
1004
1005### Selected Props (StockChartComponent)
1006All props with official API links: https://ej2.syncfusion.com/react/documentation/api/stock-chart/stockChartModel
1007
1008**Data & Series:**
1009- `dataSource` (Array | DataManager) — Source data for series (objects with `x, open, high, low, close, volume`). API: https://ej2.syncfusion.com/react/documentation/api/stock-chart/stockChartModel#datasource
1010- `series` / `StockChartSeriesCollectionDirective` — Series definitions and types (Candle, Line, Spline, Hilo, HiloOpenClose). API: https://ej2.syncfusion.com/react/documentation/api/stock-chart/stockSeries-model
1011
1012**Axes:**
1013- `primaryXAxis` (Object) — X axis configuration (typically `valueType: 'DateTime'` | `'DateTimeCategory'` | `'Numeric'`). Supports `crosshairTooltip`, `majorGridLines`, `majorTickLines`. API: https://ej2.syncfusion.com/react/documentation/api/stock-chart/stockChartAxis-model
1014- `primaryYAxis` (Object) — Y axis configuration (typically `valueType: 'Double'` or `'Logarithmic'`). Supports `labelFormat`, `rangePadding`, `minorGridLines`, `crosshairTooltip`. API: https://ej2.syncfusion.com/react/documentation/api/stock-chart/stockChartAxis-model
1015- `axes` (Array) — Additional Y-axes for multi-series scaling (use `StockChartAxesDirective` with `StockChartAxisDirective`). API: https://ej2.syncfusion.com/react/documentation/api/stock-chart/stockChartModel#axes
1016
1017**Navigation & Selectors:**
1018- `periods` (Array) — Period selector buttons (objects with `intervalType`, `interval`, `text`). API: https://ej2.syncfusion.com/react/documentation/api/stock-chart/stockChartModel#periods
1019- `enablePeriodSelector` (boolean) — Toggle period selector visibility (default: true). API: https://ej2.syncfusion.com/react/documentation/api/stock-chart/stockChartModel#enableperiodselector
1020- `enableSelector` (boolean) — Toggle range selector (thumbs) visibility (default: true). API: https://ej2.syncfusion.com/react/documentation/api/stock-chart/stockChartModel#enableselector
1021- `enableCustomRange` (boolean) — Enable custom range selection mode. API: https://ej2.syncfusion.com/react/documentation/api/stock-chart/stockChartModel#enablecustomrange
1022
1023**Analysis & Events:**
1024- `indicators` (Array) — Technical indicators configuration (SMA, EMA, RSI, MACD, Bollinger, etc.). API: https://ej2.syncfusion.com/react/documentation/api/stock-chart/stockChartIndicatorModel
1025- `stockEvents` (Array) — Stock event markers (date, text, description, type, background). API: https://ej2.syncfusion.com/react/documentation/api/stock-chart/stockEventModel
1026
1027**Interaction & UI:**
1028- `tooltip` (Object) — Tooltip settings (`enable`, `format`, `shared`). API: https://ej2.syncfusion.com/react/documentation/api/stock-chart/stockChartTooltipSettingsModel
1029- `crosshair` (Object) — Crosshair settings (`enable`, `lineType`). API: https://ej2.syncfusion.com/react/documentation/api/stock-chart/crosshairSettingsModel
1030- `legendSettings` (Object) — Legend display and templates. API: https://ej2.syncfusion.com/react/documentation/api/stock-chart/stockChartLegendSettingsModel
1031
1032**Selection & Appearance:**
1033- `selectedDataIndexes` (Array) — Programmatically set selected data points. API: https://ej2.syncfusion.com/react/documentation/api/stock-chart/stockChartModel#selecteddataindexes
1034- `selectionMode` (string) — Selection mode (None, Point, Series). API: https://ej2.syncfusion.com/react/documentation/api/stock-chart/stockChartModel#selectionmode
1035- `isMultiSelect` (boolean) — Allow multiple data point selection. API: https://ej2.syncfusion.com/react/documentation/api/stock-chart/stockChartModel#ismultiselect
1036
1037**Theming & Layout:**
1038- `theme` (string) — Chart theme (Material, Bootstrap, Fabric, Tailwind, HighContrast, etc.). API: https://ej2.syncfusion.com/react/documentation/api/stock-chart/stockChartModel#theme
1039- `background` (string) — Chart background color. API: https://ej2.syncfusion.com/react/documentation/api/stock-chart/stockChartModel#background
1040- `border` (Object) — Chart border configuration. API: https://ej2.syncfusion.com/react/documentation/api/stock-chart/stockChartBorderModel
1041- `chartArea` (Object) — Chart area styling. API: https://ej2.syncfusion.com/react/documentation/api/stock-chart/stockChartAreaModel
1042- `margin` (Object) — Chart margin configuration. API: https://ej2.syncfusion.com/react/documentation/api/stock-chart/stockMarginModel
1043- `title` (string) — Chart title. API: https://ej2.syncfusion.com/react/documentation/api/stock-chart/stockChartModel#title
1044- `titleStyle` (Object) — Title font styling. API: https://ej2.syncfusion.com/react/documentation/api/stock-chart/stockChartFontModel
1045- `width`, `height` (string) — Dimensions. API: https://ej2.syncfusion.com/react/documentation/api/stock-chart/stockChartModel#width
1046
1047**Export & Persistence:**
1048- `exportType` (Array) — Export formats available in toolbar ['PNG', 'JPEG', 'SVG', 'PDF']. Set empty array `[]` to disable export. API: https://ej2.syncfusion.com/react/documentation/api/stock-chart/stockChartModel#exporttype
1049- `enablePersistence` (boolean) — Persist chart state between page loads. API: https://ej2.syncfusion.com/react/documentation/api/stock-chart/stockChartModel#enablepersistence
1050
1051**Series & Analysis:**
1052- `series` / `StockChartSeriesCollectionDirective` — Series collection with StockChartSeriesDirective items. API: https://ej2.syncfusion.com/react/documentation/api/stock-chart/stockSeries-model
1053- `indicators` / `StockChartIndicatorsDirective` — Technical indicators collection with StockChartIndicatorDirective items. API: https://ej2.syncfusion.com/react/documentation/api/stock-chart/stockChartIndicatorModel
1054- `trendlines` / `StockChartTrendlinesDirective` — Trend lines collection with StockChartTrendlineDirective items. API: https://ej2.syncfusion.com/react/documentation/api/stock-chart/stockChartTrendlineModel
1055
1056**Accessibility & RTL:**
1057- `enableRtl` (boolean) — Enable right-to-left rendering. API: https://ej2.syncfusion.com/react/documentation/api/stock-chart/stockChartModel#enablertl
1058
1059**Zoom & Pan:**
1060- `zoomSettings` (Object) — Zoom and pan configuration. API: https://ej2.syncfusion.com/react/documentation/api/stock-chart/zoomSettingsModel
1061
1062### Methods
1063All methods with official API links: https://ej2.syncfusion.com/react/documentation/api/stock-chart/stockChartModel#methods
1064
1065- `export(type: string, fileName: string)` — Export chart as PNG, JPEG, SVG, or PDF. API: https://ej2.syncfusion.com/react/documentation/api/stock-chart/stockChartModel#export
1066- `print()` — Print the chart to a printer or PDF. API: https://ej2.syncfusion.com/react/documentation/api/stock-chart/stockChartModel#print
1067- `destroy()` — Clean up and remove the chart instance. API: https://ej2.syncfusion.com/react/documentation/api/stock-chart/stockChartModel#destroy
1068- `getModuleName()` — Returns the component module name. API: https://ej2.syncfusion.com/react/documentation/api/stock-chart/stockChartModel#getmodulename
1069- `renderPeriodSelector()` — Programmatically render the period selector. API: https://ej2.syncfusion.com/react/documentation/api/stock-chart/stockChartModel#renderperiodselector
1070- `rangeChanged(start: Date | number, end: Date | number)` — Programmatically change the visible range. API: https://ej2.syncfusion.com/react/documentation/api/stock-chart/stockChartModel#rangechanged
1071
1072### Events
1073All events with official API links: https://ej2.syncfusion.com/react/documentation/api/stock-chart/stockChartModel#events
1074
1075**Lifecycle Events:**
1076- `load` — Fired before chart is loaded. API: https://ej2.syncfusion.com/react/documentation/api/stock-chart/stockChartModel#load
1077- `loaded` — Fired after chart is loaded. API: https://ej2.syncfusion.com/react/documentation/api/stock-chart/stockChartModel#loaded
1078
1079**Data & Rendering Events:**
1080- `axisLabelRender` — Customize each axis label before rendering. API: https://ej2.syncfusion.com/react/documentation/api/stock-chart/stockChartModel#axislabelrender
1081- `seriesRender` — Fired when a series is rendered. API: https://ej2.syncfusion.com/react/documentation/api/stock-chart/stockChartModel#seriesrender
1082- `beforeExport` — Fired before export operation. API: https://ej2.syncfusion.com/react/documentation/api/stock-chart/stockChartModel#beforeexport
1083
1084**User Interaction Events:**
1085- `pointClick` — Fired when a data point is clicked. API: https://ej2.syncfusion.com/react/documentation/api/stock-chart/stockChartModel#pointclick
1086- `pointMove` — Fired when mouse moves over a data point. API: https://ej2.syncfusion.com/react/documentation/api/stock-chart/stockChartModel#pointmove
1087- `legendClick` — Fired when a legend item is clicked. API: https://ej2.syncfusion.com/react/documentation/api/stock-chart/stockChartModel#legendclick
1088- `legendRender` — Fired when legend items are rendered. API: https://ej2.syncfusion.com/react/documentation/api/stock-chart/stockChartModel#legendrender
1089
1090**Tooltip & Crosshair Events:**
1091- `tooltipRender` — Modify tooltip content before display. API: https://ej2.syncfusion.com/react/documentation/api/stock-chart/stockChartModel#tooltiprender
1092
1093**Range & Selector Events:**
1094- `rangeChange` / `onRangeChange` — Emitted when the selected range changes. API: https://ej2.syncfusion.com/react/documentation/api/stock-chart/stockChartModel#rangechange
1095- `selectorRender` — Triggered when range selector renders. API: https://ej2.syncfusion.com/react/documentation/api/stock-chart/stockChartModel#selectorrender
1096
1097**Technical Analysis Events:**
1098- `stockEventRender` — Customize stock event marker rendering. API: https://ej2.syncfusion.com/react/documentation/api/stock-chart/stockChartModel#stockeventrender
1099- `onZooming` — Fired during zoom interactions. API: https://ej2.syncfusion.com/react/documentation/api/stock-chart/stockChartModel#onzooming
1100
1101### Suggested reference files and sections
1102- `references/api.md` — Full API surface summary (props, methods, events) with links to official docs.
1103- `references/configuration.md` — Move/expand prop-specific docs (axes, theme, sizing).
1104- `references/interactive-features.md` — Add event hooks and examples for `tooltipRender`, `pointClick`, `axisLabelRender`.
1105- `references/technical-analysis.md` — Expand `indicators` and `stockEvents` API samples.
1106
1107### Minimal API example (props + events)
1108
1109```tsx
1110<StockChartComponent
1111 id="stockchart"
1112 dataSource={data}
1113 primaryXAxis={{ valueType: 'DateTime' }}
1114 enablePeriodSelector={true}
1115 indicators={[{ type: 'Sma', period: 14 }]}
1116 stockEvents={[{ date: new Date(2023,0,1), text: 'Earnings' }]}
1117 tooltip={{ enable: true }}
1118 crosshair={{ enable: true }}
1119 load={(args) => console.log('loading', args)}
1120 loaded={(args) => console.log('loaded', args)}
1121 axisLabelRender={(args) => {/* modify labels */}}
1122 pointClick={(args) => {/* handle point click */}}
1123>
1124 <Inject services={[DateTime, CandleSeries, Tooltip, Crosshair]} />
1125 <StockChartSeriesCollectionDirective>
1126 <StockChartSeriesDirective type="Candle" xName="x" open="open" high="high" low="low" close="close" />
1127 </StockChartSeriesCollectionDirective>
1128</StockChartComponent>
1129```