Introduction
Build SVG charts for the web with JS/TS or Angular. Start with a line chart and adapt its data and options to your project.
Try a chart
Open the line example to compare two series of visits. Explore points with the pointer or arrow keys, toggle a series in the legend, and see the code that generates the chart.
Separate data from presentation
In this small example, data contains the chart type, data axes, and three observations. options controls how the chart is presented. Keep IDs stable when updating a series or point, even as values or labels change.
import type { ChartData, ChartOptions } from '@neural-charts/angular';
export const data: ChartData = {
type: 'line',
axes: { x: { type: 'linear' }, y: { type: 'linear' } },
series: [{ id: 'visits', name: 'Visits', data: [
{ id: 'mon', x: 1, y: 12 },
{ id: 'tue', x: 2, y: 18 },
{ id: 'wed', x: 3, y: 15 },
] }],
};
export const options: ChartOptions = {
title: 'Weekly activity',
locale: 'en',
tooltip: { enabled: true },
};Choose the right representation
Start with the question you want to answer and choose a chart that fits your data.
| Question | Chart | Data |
|---|---|---|
| How does it change over time? | Line or area | Dates or ordered categories |
| How do categories compare? | Column or bar | Categories and values |
| How is a total divided? | Pie or donut | Parts of a whole |
| How do two values relate? | Scatter | Numeric X/Y pairs |
Use it in your application
Install @neural-charts/angular and import NeuralChart into your standalone component. Bind [data] and [options] and listen to its events to react to selection. The adapter uses the Web SVG renderer and Core calculations.