Framework
swimlane/ngx-charts avatar
swimlane/ngx-charts

ngx-charts renders SVG through Angular bindings while d3 only does the math

:bar_chart: Declarative Charting Framework for Angular

4,357 stars1,157 forksTypeScriptMIT

At a glance

What is it?
ngx-charts is Swimlane's declarative charting framework for Angular. It keeps d3 for scales, axes and shapes and lets Angular components draw and animate the SVG, which is an unusual split with real consequences for server-side rendering and for anyone who needs a chart type the library does not ship.
Who is it for?
Adopt ngx-charts when the application is already Angular, the screens you need are covered by the chart types in the README, and theming through CSS classes is the styling approach you want. Do not adopt it for a charting surface that needs custom marks, canvas-level rendering or per-point performance tuning, because those sit outside what the components expose.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 17 days ago.
What is it written in?
Mainly TypeScript, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on November 14, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • swimlane/ngx-charts4,357 ★ · -6
Star history
Repository2026-09-232026-11-14
swimlane/ngx-charts4.4k4.4k

-6 Stars in the last 52 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

Angular owns the DOM, d3 only owns the math

Most Angular chart libraries take a canvas or SVG library and hand it a data array. ngx-charts does the opposite. It uses d3 for scales, axis and shape generators and for the math functions, then lets Angular components render and animate the SVG elements through bindings. That is the project's own claim about why it is different, and it is the single decision that shapes everything else about the library.

The consequence is that your change detection cycle sits in the render path. A data point arrives, Angular bindings run, attributes update on SVG nodes. Nothing hand-patches the DOM outside the framework, which is a clean fit with the Angular platform features the README names, including ahead-of-time compilation and server-side rendering.

The other consequence is that the component tree is the abstraction. Bars, arcs, lines and legends are Angular components with inputs, and the README points at a custom charts page under docs/custom-charts.md for building charts from the components the module exposes. Anything the library does not ship can be assembled from the pieces. Anything it does not expose cannot be built that way.

The chart list is finite and the module will not grow it for you

The README lists what you get: horizontal and vertical bars in standard, grouped, stacked and normalized forms, line, area in the same three variants, pie with exploded slices and grid layout, bubble, donut, linear and radial gauge, heatmap, treemap, number cards and a sankey diagram. That is the whole surface.

Legends come in label and gradient form, and the customization list includes autoscaling, timeline filtering, line interpolation, configurable axis labels, advanced label positioning, real-time data support, advanced tooltips and per-datapoint event handlers.

Reading that list closely, two entries are about behavior rather than appearance. Real-time data support means the chart re-renders when your stream pushes new values, and the ngUpgrade note says the components work with ngUpgrade. Neither carries a stated compatibility range, which is worth knowing before you depend on either.

One npm install, and the scoped name that is not optional

The README gives a single install path and no alternatives. There is no yarn or pnpm instruction for consumers, and no mention of a UMD bundle or a script tag for use outside an Angular CLI project.

bash
npm i @swimlane/ngx-charts --save

That pulls the published package into your application dependencies. The scope matters: the repository's own package.json is named ngx-charts, but the library you install is @swimlane/ngx-charts.

If you are working inside the repository rather than consuming it, the test entry point is different. The root package.json sets `test` to a sequence of three npm-run steps, so a single command covers more than the test suite:

bash
yarn test

That expands to `lint`, `prettier:ci` and `test:unit`, where the unit runner is `ng test @swimlane/ngx-charts --watch=false`. Your branch has to satisfy the library's lint and formatting configuration before a single assertion runs, which is why contributors see style rejections ahead of test failures.

The library and its demo site are two build targets in one workspace

The repository root holds a single Angular workspace with `projects/`, `src/`, `e2e/` and a `docs/` directory, and the library is built as a separate target from the demo application. The build target names make the split explicit: `build:lib` runs `ng build @swimlane/ngx-charts`, and the production variant adds `--configuration production`.

The demo is a different target with a different base path, which matters if you copy anything out of it:

bash
npm run build:demo

That expands to a production library build followed by an Angular build that sets the environment to production and passes a base href of /ngx-charts/, because the demo is published to GitHub Pages under that subdirectory rather than at a domain root.

Packaging then runs `build:lib:prod` and a copy step that brings README.md into the distribution directory, and publishing targets that directory directly. The root package.json carries a placeholder version of 0.0.0 and pins the Angular dependencies at a range such as ~22.0.8, so the workspace file itself tells you nothing about the build you would install; read the version from the npm package instead.

Styling goes through CSS, which cuts both ways

The README makes two claims about appearance: the project puts effort into charts looking good out of the box, and the styles are fully overridable through CSS. The second is the one with engineering weight. Because nothing is drawn imperatively, a class on a bar element behaves like any other Angular styling problem, and theming does not require forking the library.

The trade-off is the mirror image of the architecture. The same binding-based rendering that lets CSS reach every mark also means you cannot reach d3's own DOM manipulation habits. Where a canvas or imperative library exposes the drawing context for custom rendering, ngx-charts exposes components with inputs. If your requirement is a custom mark that is not a variation on an existing one, the escape hatch is the custom charts page and the exported components, not an undocumented handle.

Angular-based rendering also ties chart cost to change detection. A dashboard that redraws on a timer routes every repaint through the framework, and the README says nothing about a manual or zone-independent update path.

Real-time updates are claimed, scheduling is not documented

Real-time data support appears in the customization list without a worked example anywhere in the README. There is no documented update strategy, no guidance on running the chart outside Angular's zone, and no stated ceiling on how many data points the library expects to animate. For a stream that pushes values every few hundred milliseconds, that silence is the decision point.

The sankey diagram and the treemap are the two chart types where that gap bites hardest. Both compute layout from the data relationships, so a fast-changing stream means the layout recomputes on each pass rather than only the marks moving. The README gives no sizing or batching guidance for either.

Heatmaps carry a different cost. Every cell is an SVG rect managed by Angular, so a large matrix multiplies component instances and the cost of a redraw. A dashboard where one screen holds a scatter of ten thousand points and another holds a bar chart of eight categories is an easy comparison. When both screens look similar on paper, count the cells and points first, then decide whether the library's SVG model fits.

Chart.js and Apache ECharts differ in who owns the render loop

Chart.js draws to a canvas element and owns its own render loop; ngx-charts does not use canvas at all and lets Angular render SVG from component bindings. That is the substantive difference in approach, and it decides which problem you are solving. Chart.js is a rendering library you call imperatively, ngx-charts is a component set you template. Running both in one application means two rendering models on the same page.

Apache ECharts is a complete renderer with its own animation and layout engine, and a wrapper package brings it into Angular. The trade runs opposite to ngx-charts: a wider type catalogue and an independent layout engine on one side, less direct control over the DOM and the Angular lifecycle on the other.

The practical test is who needs to own the mark. If a designer wants to restyle a bar by class name, ngx-charts is the easier fit. If a product requirement says the chart must survive a hundred thousand points on a low-end tablet, an engine that decides how much to draw is the safer one, because ngx-charts draws every point you hand it.

Editorial conclusion

Adopt ngx-charts when the application is already Angular, the screens you need are covered by the chart types in the README, and theming through CSS classes is the styling approach you want. Do not adopt it for a charting surface that needs custom marks, canvas-level rendering or per-point performance tuning, because those sit outside what the components expose. The library also suits an Angular team willing to treat the exported components as its extension point. Before installing, check that your Angular version falls inside the peer range in package.json, run `yarn test` once on a clean branch to see what the lint and prettier steps reject, and confirm that the version on npm is the one carrying the behaviour you need.

Frequently asked questions

How do I use ngx-charts in Angular?

Install the package with `npm i @swimlane/ngx-charts --save`, then import the ngx-charts module in your Angular application and use its chart components in a template. The README links to the gitbook documentation and the demo site at swimlane.github.io/ngx-charts for the rest.

Is ngx-charts free?

The project is MIT licensed and published to npm as @swimlane/ngx-charts. The LICENSE file ships inside the published package alongside README.md and the changelog.

What is the difference between ngx-charts and ngx-echarts?

ngx-charts uses d3 for scales, axes and shape generators and lets Angular components render and animate the SVG. ngx-echarts wraps Apache ECharts, which brings its own rendering engine and layout system rather than delegating rendering to Angular bindings.

How does ngx-charts compare to Chart.js?

Chart.js draws to a canvas element with its own render loop and is driven imperatively. ngx-charts draws SVG through Angular component bindings and is driven by inputs in a template, so styling reaches every mark through CSS but custom rendering stays inside the component model.

What are the alternatives to ngx-charts?

Chart.js and Apache ECharts are the common alternatives, and both draw through a rendering engine of their own rather than through Angular bindings. For charts outside the list the README names, a wrapper around one of those engines gives a wider type catalogue at the cost of DOM-level control.

Official sources

  1. Issues
  2. License: MIT
  3. Project website
  4. README
  5. swimlane/ngx-charts on GitHub
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/swimlane-ngx-charts.svg)](https://hysenlabs.com/projects/swimlane-ngx-charts)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/swimlane-ngx-charts.svg)](https://hysenlabs.com/projects/swimlane-ngx-charts)

Was this useful?