AG Charts is available for download from NPM & Yarn. Once installed, you just need to import the package.
Installation
Install the ag-charts-react
package, which also installs ag-charts-community
:
npm install ag-charts-react
yarn add ag-charts-react
To use AG Charts Enterprise features, install the ag-charts-enterprise
package:
npm install ag-charts-enterprise
yarn add ag-charts-enterprise
You can test AG Charts Enterprise locally without a licence. To test in production, access support and remove the watermark & console warnings, request a trial licence.
Importing
Import the AgCharts
component from the ag-charts-react
package:
import { AgCharts } from 'ag-charts-react';
To use AG Charts Enterprise features, import the ag-charts-enterprise
package:
import 'ag-charts-enterprise';
See the Installing Enterprise Licence Key docs for more information on how to install your Enterprise or Trial licence key.
Accessing AG Charts
To use AG Charts in your React application, return the AgCharts
component with your chart options:
const MyChart = () => {
// Define chart options; Mutating this object will cause the chart to update
const [chartOptions, setChartOptions] = useState({...});
// Return the AgCharts component with the chart options
return <AgCharts options={options} />;
};