Implementing Charts in Syncfusion TypeScript & JavaScript
The Syncfusion Chart component provides a comprehensive suite of visualization tools for building interactive, data-driven dashboards. With 15+ chart types, advanced customization options, and real-time data support, you can create professional visualizations for any use case. Works in both TypeScript (with full type safety) and JavaScript (ES5 CDN-based or webpack).
Platform Support
This skill covers both TypeScript and JavaScript implementations:
TypeScript (Primary):
- Full type definitions and IDE support
- Module-based imports with
Chart.Inject()
- Webpack/bundler-based setup
- Advanced type checking
JavaScript (ES5):
- CDN-based or local script loading
- Global namespace access (
ej.charts.Chart)
- No build step required
- Compatible with ES5 and modern browsers
Where noted, code examples show both TS and JS variants. Choose based on your project setup.
When to Use This Skill
Use this skill when you need to:
- Create basic charts - Line, area, bar, column, pie, or scatter plots
- Visualize complex data - Multiple series, stacked charts, grouped data
- Build dashboards - Combine charts with real-time data updates
- Customize appearance - Colors, fonts, animations, themes
- Add interactivity - Tooltips, legends, selection, zooming, crosshairs
- Implement advanced features - Technical indicators, trendlines, annotations
- Export charts - PNG, SVG, PDF, or print functionality
- Optimize performance - Handle large datasets efficiently
- Support accessibility - WCAG compliance, keyboard navigation, RTL
Navigation Guide
Choose the reference that matches your task:
Getting Started
📄 Read: references/getting-started.md
- Installation and setup
- Basic chart creation with minimal code
- Data binding fundamentals
- Theme selection and initial configuration
Chart Types & Selection
📄 Read: references/chart-types.md
- Overview of 15+ chart types (Line, Area, Bar, Column, Pie, Doughnut, Polar, Radar, Waterfall, Funnel, Stock, etc.)
- When to use each type
- Basic implementation for each chart type
- Series combinations and variations
Series Configuration
📄 Read: references/series-configuration.md
- Configuring series properties and data
- Data labels and marker customization
- Stacking and grouping strategies
- Empty point handling and data gaps
Axes Customization
📄 Read: references/axes-customization.md
- Category, numeric, and datetime axes
- Axis labels, formatting, and ranges
- Multiple axes and panes
- Custom axis positioning and scrolling
Features & Interaction
📄 Read: references/features-interaction.md
- Tooltips, crosshairs, and track balls
- Legend configuration and positioning
- Selection, zooming, and panning
- Annotations, markers, and indicators
Styling & Appearance
📄 Read: references/styling-appearance.md
- Color schemes, gradients, and themes
- Font, border, and background customization
- Chart area and plot area styling
- Responsive design and layout
Advanced Features
📄 Read: references/advanced-features.md
- Technical indicators (SMA, EMA, MACD, RSI, Stochastic, etc.)
- Trendlines and trend analysis
- Export to PNG, SVG, PDF, Print
- Animations and smooth transitions
Data Handling & Updates
📄 Read: references/data-handling.md
- Dynamic data updates and real-time charts
- Data editing and user interaction
- Loading and caching large datasets
- Working with various data sources
Accessibility & RTL
📄 Read: references/accessibility-rtl.md
- WCAG compliance and accessibility standards
- Keyboard navigation
- ARIA labels and screen reader support
- Right-to-left (RTL) language support
API Reference
📄 Read: references/api-reference.md
- Complete Chart API documentation
- All classes, enumerations, and interfaces
- Methods and events reference
- Module injection guide
- Configuration patterns
Troubleshooting & Optimization
📄 Read: references/troubleshooting.md
- Common issues and solutions
- Performance optimization techniques
- Browser compatibility notes
- Debugging strategies
Quick Start Example
TypeScript:
import { Chart, LineSeries, DateTime, Legend, Tooltip, Category } from '@syncfusion/ej2-charts';
// Inject required modules
Chart.Inject(LineSeries, DateTime, Legend, Tooltip, Category);
const data = [
{ month: 'Jan', sales: 21 },
{ month: 'Feb', sales: 24 },
{ month: 'Mar', sales: 36 },
{ month: 'Apr', sales: 38 },
{ month: 'May', sales: 54 }
];
const chart = new Chart({
primaryXAxis: { valueType: 'Category' },
title: 'Monthly Sales',
tooltip: { enable: true },
legendSettings:{ visible: true },
series: [{
dataSource: data,
xName: 'month',
yName: 'sales',
type: 'Line',
name: 'Sales'
}]
}, '#chart');
Common Patterns
Pattern 1: Multi-Series Bar Chart
Multiple data series displayed side-by-side for comparison:
series: [
{ dataSource: data, xName: 'month', yName: 'sales', type: 'Column', name: 'Sales' },
{ dataSource: data, xName: 'month', yName: 'revenue', type: 'Column', name: 'Revenue' }
]
Pattern 2: Stacked Column with Legend
Stacked visualization showing composition and trends:
series: [
{ dataSource: data, xName: 'category', yName: 'value1', type: 'StackingColumn' },
{ dataSource: data, xName: 'category', yName: 'value2', type: 'StackingColumn' }
],
legend: { visible: true, position: 'Bottom' }
Pattern 3: Real-Time Data Update
Continuously updating chart with new data points:
// Update with new data
chart.series[0].dataSource = updatedData;
chart.refresh();
Pattern 4: Interactive Selection
Enable user selection with event handling:
pointRender: (args: IPointRenderEventArgs) => {
// Customize point on selection
},
selectionMode: 'Point'
Key Properties
Chart-level:
primaryXAxis, primaryYAxis - Configure axes
series - Define data series
tooltip - Enable/configure tooltips
legend - Control legend display
title - Chart title
Series-level:
dataSource - Data binding
xName, yName - Data field mapping
type - Chart type (Line, Column, Pie, etc.)
marker - Point customization
dataLabel - Label display
Customization:
palette - Color scheme
theme - Built-in theme
background - Chart background
height, width - Dimensions
1---2name: syncfusion-javascript-chart3description: Implements Syncfusion JavaScript chart controls (Line, Area, Bar, Column, Pie, Polar, Radar, Waterfall, Stock). Use when building interactive data visualizations, dashboards, or real-time charts. Covers series and axes configuration, styling, animations, exporting, and technical indicators. Works with TypeScript (webpack/modules) and JavaScript (CDN/ES5).4---56# Implementing Charts in Syncfusion TypeScript & JavaScript78The Syncfusion Chart component provides a comprehensive suite of visualization tools for building interactive, data-driven dashboards. With 15+ chart types, advanced customization options, and real-time data support, you can create professional visualizations for any use case. Works in both TypeScript (with full type safety) and JavaScript (ES5 CDN-based or webpack).910## Platform Support1112This skill covers both TypeScript and JavaScript implementations:1314**TypeScript (Primary):**15- Full type definitions and IDE support16- Module-based imports with `Chart.Inject()`17- Webpack/bundler-based setup18- Advanced type checking1920**JavaScript (ES5):**21- CDN-based or local script loading22- Global namespace access (`ej.charts.Chart`)23- No build step required24- Compatible with ES5 and modern browsers2526**Where noted**, code examples show both TS and JS variants. Choose based on your project setup.2728## When to Use This Skill2930Use this skill when you need to:31- **Create basic charts** - Line, area, bar, column, pie, or scatter plots32- **Visualize complex data** - Multiple series, stacked charts, grouped data33- **Build dashboards** - Combine charts with real-time data updates34- **Customize appearance** - Colors, fonts, animations, themes35- **Add interactivity** - Tooltips, legends, selection, zooming, crosshairs36- **Implement advanced features** - Technical indicators, trendlines, annotations37- **Export charts** - PNG, SVG, PDF, or print functionality38- **Optimize performance** - Handle large datasets efficiently39- **Support accessibility** - WCAG compliance, keyboard navigation, RTL4041## Navigation Guide4243Choose the reference that matches your task:4445### Getting Started46📄 **Read:** [references/getting-started.md](references/getting-started.md)47- Installation and setup48- Basic chart creation with minimal code49- Data binding fundamentals50- Theme selection and initial configuration5152### Chart Types & Selection53📄 **Read:** [references/chart-types.md](references/chart-types.md)54- Overview of 15+ chart types (Line, Area, Bar, Column, Pie, Doughnut, Polar, Radar, Waterfall, Funnel, Stock, etc.)55- When to use each type56- Basic implementation for each chart type57- Series combinations and variations5859### Series Configuration60📄 **Read:** [references/series-configuration.md](references/series-configuration.md)61- Configuring series properties and data62- Data labels and marker customization63- Stacking and grouping strategies64- Empty point handling and data gaps6566### Axes Customization67📄 **Read:** [references/axes-customization.md](references/axes-customization.md)68- Category, numeric, and datetime axes69- Axis labels, formatting, and ranges70- Multiple axes and panes71- Custom axis positioning and scrolling7273### Features & Interaction74📄 **Read:** [references/features-interaction.md](references/features-interaction.md)75- Tooltips, crosshairs, and track balls76- Legend configuration and positioning77- Selection, zooming, and panning78- Annotations, markers, and indicators7980### Styling & Appearance81📄 **Read:** [references/styling-appearance.md](references/styling-appearance.md)82- Color schemes, gradients, and themes83- Font, border, and background customization84- Chart area and plot area styling85- Responsive design and layout8687### Advanced Features88📄 **Read:** [references/advanced-features.md](references/advanced-features.md)89- Technical indicators (SMA, EMA, MACD, RSI, Stochastic, etc.)90- Trendlines and trend analysis91- Export to PNG, SVG, PDF, Print92- Animations and smooth transitions9394### Data Handling & Updates95📄 **Read:** [references/data-handling.md](references/data-handling.md)96- Dynamic data updates and real-time charts97- Data editing and user interaction98- Loading and caching large datasets99- Working with various data sources100101### Accessibility & RTL102📄 **Read:** [references/accessibility-rtl.md](references/accessibility-rtl.md)103- WCAG compliance and accessibility standards104- Keyboard navigation105- ARIA labels and screen reader support106- Right-to-left (RTL) language support107108### API Reference109📄 **Read:** [references/api-reference.md](references/api-reference.md)110- Complete Chart API documentation111- All classes, enumerations, and interfaces112- Methods and events reference113- Module injection guide114- Configuration patterns115116### Troubleshooting & Optimization117📄 **Read:** [references/troubleshooting.md](references/troubleshooting.md)118- Common issues and solutions119- Performance optimization techniques120- Browser compatibility notes121- Debugging strategies122123## Quick Start Example124125**TypeScript:**126```typescript127import { Chart, LineSeries, DateTime, Legend, Tooltip, Category } from '@syncfusion/ej2-charts';128129// Inject required modules130Chart.Inject(LineSeries, DateTime, Legend, Tooltip, Category);131132const data = [133 { month: 'Jan', sales: 21 },134 { month: 'Feb', sales: 24 },135 { month: 'Mar', sales: 36 },136 { month: 'Apr', sales: 38 },137 { month: 'May', sales: 54 }138];139140const chart = new Chart({141 primaryXAxis: { valueType: 'Category' },142 title: 'Monthly Sales',143 tooltip: { enable: true },144 legendSettings:{ visible: true },145 series: [{146 dataSource: data,147 xName: 'month',148 yName: 'sales',149 type: 'Line',150 name: 'Sales'151 }]152}, '#chart');153```154155## Common Patterns156157### Pattern 1: Multi-Series Bar Chart158Multiple data series displayed side-by-side for comparison:159160```typescript161series: [162 { dataSource: data, xName: 'month', yName: 'sales', type: 'Column', name: 'Sales' },163 { dataSource: data, xName: 'month', yName: 'revenue', type: 'Column', name: 'Revenue' }164]165```166167### Pattern 2: Stacked Column with Legend168Stacked visualization showing composition and trends:169170```typescript171series: [172 { dataSource: data, xName: 'category', yName: 'value1', type: 'StackingColumn' },173 { dataSource: data, xName: 'category', yName: 'value2', type: 'StackingColumn' }174],175legend: { visible: true, position: 'Bottom' }176```177178### Pattern 3: Real-Time Data Update179Continuously updating chart with new data points:180181```typescript182// Update with new data183chart.series[0].dataSource = updatedData;184chart.refresh();185```186187### Pattern 4: Interactive Selection188Enable user selection with event handling:189190```typescript191pointRender: (args: IPointRenderEventArgs) => {192 // Customize point on selection193},194selectionMode: 'Point'195```196197## Key Properties198199**Chart-level:**200- `primaryXAxis`, `primaryYAxis` - Configure axes201- `series` - Define data series202- `tooltip` - Enable/configure tooltips203- `legend` - Control legend display204- `title` - Chart title205206**Series-level:**207- `dataSource` - Data binding208- `xName`, `yName` - Data field mapping209- `type` - Chart type (Line, Column, Pie, etc.)210- `marker` - Point customization211- `dataLabel` - Label display212213**Customization:**214- `palette` - Color scheme215- `theme` - Built-in theme216- `background` - Chart background217- `height`, `width` - Dimensions