Declarative Highcharts configuration builder with an immutable, chainable API

Usage no npm install needed!

<script type="module">
  import highchartsConfig from 'https://cdn.skypack.dev/highcharts-config';



Table of contents



$ yarn add highcharts-config


$ npm i highcharts-config --save


import buildConfig from 'highcharts-config';

const config = buildConfig()
    // use shorthand methods to set properties on the object
    .title('text', 'My fancy chart')
    // then add types of charts
    .addType('spline', {
      data: [3, 5, 6, 2, 10, 7],
      name: 'Average'
    .addType('column', {
        name: 'Total',
        data: [
            {name: 'Foo', y: 13}, 
            {name: 'Bar', y: 23}, 
            {name: 'Baz', y: 19}
    // finally, retrieve the built config


Highcharts is a fantastic charting library, but it's configuration can be daunting and confusing. highcharts-config tries to simplify this process with a natural API and a focus on reusability. There are chainable convenience methods for both chart and global options configurations, and each step in the chain returns a new instance so it can be stored and reused.

It should be noted that while the construct of immutability is applied when updating the configurations, it is not rigidly enforced (Highcharts barks when the configuration is deeply frozen). This means you can mutate the configuration directly without the use of the API, however it is highly discouraged.


Check out the API page for complete information.


Standard stuff, clone the repo and yarn / npm install dependencies. The npm scripts available:

  • build => run webpack to build development dist file with NODE_ENV=development
  • build:minifed => run webpack to build production dist file with NODE_ENV=production
  • dev => run webpack dev server to run example app (playground)
  • lint => run ESLint against all files in the src folder
  • prepublish => runs prepublish:compile
  • prepublish:compile => run lint, test:coverage, transpile, build, and build:minified
  • test => run AVA test functions with NODE_ENV=test
  • test:coverage => run test but with nyc for coverage checker
  • test:watch => run test, but with persistent watcher
  • transpile => run babel against all files in src to create files in lib