Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
AgCharts
✓ import { AgCharts } from 'ag-charts-community'
✗ const AgCharts = require('ag-charts-server-side')
AgCharts is imported from ag-charts-community; ag-charts-server-side provides the rendering environment.
createServerSideChart
✓ import { createServerSideChart } from 'ag-charts-server-side'
As of v13, function is exported from ag-charts-server-side.
AgChartInstance
✓ import type { AgChartInstance } from 'ag-charts-community'
✗ import { AgChartInstance } from 'ag-charts-server-side'
AgChartInstance is a type exported from ag-charts-community, not from server-side package.
Creates a server-side bar chart with sample data, renders it to PNG buffer.
import { createServerSideChart } from 'ag-charts-server-side';
import { AgCharts } from 'ag-charts-community';
async function generateChart() {
const chart = await createServerSideChart({
container: null,
width: 800,
height: 600,
data: [
{ month: 'Jan', revenue: 1200 },
{ month: 'Feb', revenue: 1500 },
{ month: 'Mar', revenue: 1100 },
],
series: [{ type: 'bar', xKey: 'month', yKey: 'revenue' }],
});
const buffer = await chart.renderToBuffer({ format: 'png' });
console.log('Chart PNG buffer:', buffer);
}
generateChart().catch(console.error);
Errors
Common errors & fixes
Error: Could not find module 'canvas'
Missing native canvas dependency on Linux.
fixInstall 'canvas' package: npm install canvas
TypeError: chart.renderToBuffer is not a function
Using older API without renderToBuffer.
fixUpgrade to ag-charts-server-side@13 and use chart.renderToBuffer() instead of .render().
Module not found: Can't resolve 'ag-charts-community'
Missing peer dependency ag-charts-community.
fixInstall ag-charts-community: npm install ag-charts-community
Audit
Dependencies
ag-charts-communityrequiredCore charting library; server-side rendering depends on its API