AG Charts Enterprise
AG Charts Enterprise is a high-performance, canvas-based charting library for advanced data visualization in JavaScript and TypeScript applications. Currently at version 13.2.1, the library maintains an active development pace with frequent minor and patch releases. It offers extensive customization capabilities and native component wrappers for popular frameworks like React, Angular, and Vue. A key differentiator is its commitment to zero third-party dependencies, which helps ensure a lean bundle size and minimizes potential conflicts. It is specifically designed for enterprise-grade applications requiring robust, fully-featured, and highly performant charting solutions for complex datasets and interactive dashboards.
Common errors
-
AG Charts: no license key
cause The application is using the `ag-charts-enterprise` package, but a valid license key has not been provided or correctly set.fixEnsure you have a valid AG Charts Enterprise license key. Implement `LicenseManager.setLicenseKey('YOUR_LICENSE_KEY')` at the root of your application before any chart components are rendered. -
Property 'create' does not exist on type 'typeof import("/node_modules/ag-charts-enterprise/dist/ag-charts-enterprise")'. Did you mean 'AgCharts.create'?cause When importing `ag-charts-enterprise` as `* as AgCharts`, TypeScript correctly infers that `create` is a static method on the `AgCharts` object, but users might mistakenly try to access it directly as if `AgCharts` was the function itself, or misunderstand the default vs. named export pattern.fixEnsure you are calling `AgCharts.create()` after importing the module as `import * as AgCharts from 'ag-charts-enterprise';`. If you only need `create`, you could technically `import { create } from 'ag-charts-enterprise';`, but `* as AgCharts` is the recommended pattern. -
Error: `container` is required for `create` method.
cause The `container` property was not provided in the chart options object, or the specified DOM element does not exist when `AgCharts.create()` is called.fixVerify that your `options` object includes a `container` property set to a valid DOM element or an ID string (e.g., `'myChart'`). Ensure the DOM element exists in the document before `AgCharts.create()` is invoked.
Warnings
- breaking Version 13.0.0 introduced significant API changes, particularly a complete rework of the configuration API. Charts are now created and updated using a declarative JSON configuration object that mirrors the chart's structure, replacing many older imperative methods and property names.
- gotcha AG Charts Enterprise requires a valid license key for commercial use. Running the enterprise version without a license will typically result in a watermark or other license-related notifications appearing on your charts. While it might function for development, deployment without a license is a violation of terms.
- gotcha While AG Charts boasts high performance, rendering extremely large datasets (tens or hundreds of thousands of data points or more, especially with complex series types or many interactive features) can still impact browser performance and responsiveness.
- gotcha AG Charts leverages a canvas-based rendering engine. While performant, this means that individual chart elements are not directly accessible via the DOM in the same way SVG or HTML-based charting libraries are. Accessibility (A11y) features are provided by the library but require explicit configuration.
Install
-
npm install ag-charts-enterprise -
yarn add ag-charts-enterprise -
pnpm add ag-charts-enterprise
Imports
- AgCharts
const AgCharts = require('ag-charts-enterprise');import * as AgCharts from 'ag-charts-enterprise';
- AgChartsReact
import AgChartsReact from 'ag-charts-react';
import { AgChartsReact } from 'ag-charts-react'; - AgChartOptions
import { AgChartOptions } from 'ag-charts-enterprise';import type { AgChartOptions } from 'ag-charts-enterprise';
Quickstart
import * as AgCharts from 'ag-charts-enterprise';
document.addEventListener('DOMContentLoaded', () => {
const data = [
{ os: 'Windows', share: 75.9 },
{ os: 'macOS', share: 15.8 },
{ os: 'Linux', share: 2.1 },
{ os: 'Other', share: 6.2 }
];
const options = {
container: document.getElementById('myChart'),
data: data,
series: [{
type: 'pie',
angleKey: 'share',
legendItemKey: 'os',
sectorLabelKey: 'share',
sectorLabel: {
formatter: ({ datum, sectorLabelKey }) => `${datum[sectorLabelKey]}%`
}
}],
title: {
text: 'OS Market Share (2024)'
},
subtitle: {
text: 'Worldwide Desktop Operating Systems'
}
};
AgCharts.create(options);
});
// In your HTML: <div id="myChart" style="height: 400px; width: 600px;"></div>