apexcharts.js README

The project's README from github.com/apexcharts/apexcharts.js. As one markdown file: README.md.

ApexCharts

Modern, interactive JavaScript charts your users will love, built for dashboards, SaaS, and data-heavy UIs.

npm version downloads TypeScript License jsdelivr

Live demos · Documentation · License

ApexCharts gallery

Why ApexCharts

New in v6

Version 6 turns a chart from a picture you look at into a surface you investigate, author, and share. Most features below are opt-in and tree-shakeable; existing configs keep working unchanged.

Install

npm install apexcharts

Or via CDN:

<script src="https://cdn.jsdelivr.net/npm/apexcharts"></script>

Quick start

import ApexCharts from 'apexcharts'

const chart = new ApexCharts(document.querySelector('#chart'), {
  chart: { type: 'bar' },
  series: [{ name: 'Sales', data: [30, 40, 35, 50, 49, 60, 70, 91, 125] }],
  xaxis: { categories: [1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999] }
})

chart.render()

Browse 100+ ready-to-use samples: copy, paste, ship.

Chart types

Combine any of the above as mixed/combo charts, stacked variants, sparklines, or synchronized multi-chart layouts.

Framework wrappers

Official:

Community:

Server-side rendering

Render chart HTML on the server, then hydrate in the browser. Works with Next.js, Nuxt, SvelteKit, Astro, Remix, and any Node-based framework.

// Server
import ApexCharts from 'apexcharts/ssr'

const chartHTML = await ApexCharts.renderToHTML({
  chart: { type: 'bar' },
  series: [{ data: [30, 40, 35, 50, 49, 60, 70, 91, 125] }],
  xaxis: { categories: [1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999] }
}, { width: 500, height: 300 })

// Returns hydration-ready HTML with embedded SVG
// Client
import ApexCharts from 'apexcharts/client'

ApexCharts.hydrate(document.getElementById('my-chart'))
// or: ApexCharts.hydrateAll()

No more dynamic(() => import(...), { ssr: false }) workarounds: the chart renders on the server and becomes interactive on hydration.

Tree-shaking: ship only what you use

import ApexCharts from 'apexcharts' gives you every chart type and the everyday features. Nine optional features ship outside it and are imported explicitly (marked opt-in below); each warns in the console if its config is set but the feature is absent. Adding one to the default bundle is a single line, and the two share one copy of the core:

import ApexCharts from 'apexcharts'
import 'apexcharts/features/trellis'

For a smaller bundle still, start from apexcharts/core and add only what you need:

import ApexCharts from 'apexcharts/core'   // bare class: no chart types, no features

// Chart types (match the value of chart.type)
import 'apexcharts/line'
import 'apexcharts/bar'
// import 'apexcharts/area'
// import 'apexcharts/scatter'
// import 'apexcharts/unit'         // dot / pictogram / waffle / beeswarm (premium; 'waffle' aliases this)

// Optional features
import 'apexcharts/features/legend'
import 'apexcharts/features/toolbar'      // zoom/pan toolbar
// import 'apexcharts/features/exports'      // SVG/PNG/CSV download
// import 'apexcharts/features/annotations'
// import 'apexcharts/features/keyboard'     // keyboard navigation
// import 'apexcharts/features/drilldown'    // hierarchical drill-down
// import 'apexcharts/features/morph'        // animated chart-type morphs
// import 'apexcharts/features/history'      // undo/redo (premium, opt-in)
// import 'apexcharts/features/perspectives' // shareable view state (premium, opt-in)
// import 'apexcharts/features/storyboard'   // scrollytelling, incl. perspectives (premium, opt-in)
// import 'apexcharts/features/facet'        // design tokens + OS themes
// import 'apexcharts/features/weave'        // plugin platform
// import 'apexcharts/features/marks'        // custom series types
// import 'apexcharts/features/link'         // crossfilter / linked views (premium, opt-in)
// import 'apexcharts/features/ink'          // on-chart annotation editing (premium, opt-in)
// import 'apexcharts/features/measure'      // measure/delta ruler (premium, opt-in)
// import 'apexcharts/features/context-menu' // right-click context menu (premium, opt-in)
// import 'apexcharts/features/renderer-canvas' // canvas series renderer (opt-in)
// import 'apexcharts/features/trellis'     // small multiples (premium, opt-in)
// import 'apexcharts/features/raincloud'   // raincloud chart type statistics (premium, opt-in)

A page without a bundler gets the same choice. apexcharts.js stays batteries-included, and apexcharts.core.min.js is the lean baseline you build up from:

<script src="https://cdn.jsdelivr.net/npm/apexcharts/dist/apexcharts.core.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/apexcharts/dist/line.js"></script>
<script src="https://cdn.jsdelivr.net/npm/apexcharts/dist/features/legend.js"></script>

Opt-in features work the same way there: load dist/features/<name>.js after whichever bundle the page already has.

See the tree-shaking guide for the complete list of entry points.

Shapes for the unit chart

apexcharts/unit-shapes is a companion kit: 39 shapes a unit chart can pack its dots into, as silhouettes (heart, house, globe, tree), stroked glyphs (checkmark, arrow, heartbeat trace) and a composer that draws a number in its own dots. Every shape is a plain function of the marks and the plot rectangle, so it repacks at any dot count and any size, and importing one costs about 4 KB gzipped with the rest shaken out.

import ApexCharts from 'apexcharts'
import { heart } from 'apexcharts/unit-shapes'

new ApexCharts(el, {
  chart: { type: 'unit' },
  series: [576, 168, 42, 34],
  labels: ['Owned', 'Mortgaged', 'Renting', 'Other'],
  plotOptions: { unit: { layout: 'custom', positions: heart } },
}).render()

Shapes are composable (outlined(heart) traces it instead of filling it, heart.with({ order: 'cols' }) changes where each series band lands), and preview(heart, { series }) renders one to an SVG string with no chart and no DOM, for docs and build-time images. From a script tag, dist/unit-shapes.js exposes the same kit as ApexUnitShapes and registers every shape by name.

The shape you want is probably not one of the 39, and it does not have to be. positions takes any function of the marks and the plot rectangle, so there are three ways in, none of which needs a release from us:

import { shapeFrom, strokeFrom } from 'apexcharts/unit-shapes'

shapeFrom('M 26 71 A 24 21 0 1 1 74 71 …')        // your own outline, packed like ours
strokeFrom('M 6 76 L 24 44 L 40 60 …', { width: 12 })  // a centreline, for a line
positions: (objects, rect) => objects.map(…)      // your own rule, no kit at all

Working demo of all three, including the outline-authoring rules (subpaths union, a reverse-wound one cuts a hole): bring-your-own-shape.

Premium features & licensing

Most of ApexCharts is free and open source. A small set of advanced features are premium and require a license key:

Feature Enabled by
Unit chart type (dot / pictogram / waffle / beeswarm) chart.type: 'unit' / chart.type: 'waffle'
Raincloud chart type (half-density + box + raw points) chart.type: 'raincloud' (needs apexcharts/features/raincloud, not in the default bundle)
Storyboard (scrollytelling) chart.storyboard.bind(...)
Linked views / crossfilter chart.link.enabled / chart.link.dimension / ApexCharts.crossfilter()
Ink layer (on-chart annotation editing) chart.ink.enabled
Measure / delta ruler chart.measure.enabled
Context menu (right-click) chart.contextMenu.enabled
Perspectives (shareable view state) chart.perspectives.apply() / .save() / ApexCharts.perspectives.decode()
History (undo/redo) chart.history.enabled

Without a valid key these features still work (trial mode), but the chart shows an "APEXCHARTS" watermark. A valid key removes it. Every other chart type and feature is free and never watermarked; the premium chart types are unit (aliased by waffle) and raincloud, both listed above.

import ApexCharts from 'apexcharts'

// Set once, before rendering. Applies to every chart on the page.
ApexCharts.setLicense('APEX-xxxxxxxx')

Alternatives to setLicense:

// Global variable (used when setLicense was not called):
window.Apex = { license: 'APEX-xxxxxxxx' }

// Per-chart override (most specific wins):
new ApexCharts(el, { chart: { license: 'APEX-xxxxxxxx' /* ... */ } })

Precedence per chart: chart.license -> ApexCharts.setLicense() -> window.Apex.license -> unlicensed (trial). The watermark is re-evaluated on every render, so a late setLicense(validKey) followed by chart.update() clears it.

Keys are shared across the whole ApexCharts family (apexgantt, apextree, apexsankey, apex-grid-enterprise, apexstock), so one customer key works everywhere. Get a license at apexcharts.com/pricing.

Browser support

ApexCharts works in all modern evergreen browsers (Chrome, Firefox, Safari, Edge). For server-side rendering, Node.js 18+ is required.

Documentation

Contributing

npm install
npm run dev     # vite build --watch
npm test        # e2e + unit

See CONTRIBUTING.md for setup, coding conventions, and PR guidelines.

License

ApexCharts uses a revenue-based license:

Full terms: apexcharts.com/license

Need an enterprise data grid?

We've partnered with Infragistics, creators of Ignite UI: high-performance data grids that handle unlimited rows and columns, with custom templates and real-time updates.

Ignite UI Data Grid

Available for:

Angular · React · Blazor · Web Components · jQuery

Contact

apexcharts.js (apexcharts/apexcharts.js)

Searching Database…

What is this?ApexCharts is a JavaScript charting library for building interactive, SVG-based charts, designed for dashboards, SaaS products, and data-heavy UIs.
Is this a standalone app or a library I add to my own project?It is a library you install via npm or CDN and call from your own JS/TS code; it has zero runtime dependencies and works with vanilla JS or any framework.
How do I add it to a project?Install the package (npm) or load it via CDN, then import ApexCharts and create a chart from a config object; there are 100+ ready-to-use samples to copy and ship.
Do I need React, Vue, or any other framework to use it?No, it has zero runtime dependencies and works standalone, but official wrappers exist for React, Vue 3/2, Angular, Blazor, and Stencil if you want them.
Are the premium features (like unit/waffle charts) usable without paying?Premium chart types and features (unit/waffle, raincloud, storyboard, crossfilter, ink annotations, measure, context menu, perspectives, history) work without a license key but show an 'APEXCHARTS' watermark until you add a valid key.
Who is this aimed at?Frontend developers building dashboards, SaaS products, or any app needing interactive charts, from simple line/bar charts to real-time streaming or dense scatter plots with hundreds of thousands of points.
What are the licensing terms?ApexCharts uses a revenue-based license: free for individuals and organizations under $2M USD annual gross revenue (including commercial/internal use), with a commercial license required above that threshold.
What chart types does it support out of the box?18+ chart types including line, area, bar, column, pie, donut, radar, heatmap, treemap, candlestick, boxplot, violin, funnel, pyramid, and gauge, plus mixed/combo and sparkline variants.
Does it support server-side rendering?Yes, it renders real SVG on the server for Next.js, Nuxt, SvelteKit, Astro, and other Node-based frameworks, then hydrates on the client without needing dynamic-import SSR workarounds.
Can I keep the bundle size small?Yes, it is tree-shakable — importing only the chart types and features you need typically cuts bundle size by 30-60%, and a minimal apexcharts/core build lets you add only what you use.
What is new in version 6?V6 adds a plugin platform, canvas rendering for dense series, undo/redo history, shareable view-state 'perspectives', OS-aware themes, custom series types, native touch gestures, crossfilter dashboards, annotation authoring, a measure ruler, context menus, real-time streaming, and scrollytelling (storyboard).
What are similar projects?uPlot, dsh-genui, visx, G2, highcharts, charts, ascii, vega
Creator
apexcharts
Size
233.7 MB
Stars
15.2K
Age
8y
Commits · 90 Days