🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

highcharts-config

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

highcharts-config

Declarative Highcharts configuration builder with an immutable, chainable API

latest
Source
npmnpm
Version
1.1.0
Version published
Maintainers
1
Created
Source

highcharts-config

Table of contents

  • Installation
  • Usage
  • Summary
  • API
  • Development

Installation

yarn

$ yarn add highcharts-config

npm

$ npm i highcharts-config --save

Usage

import buildConfig from 'highcharts-config';

const config = buildConfig()
    // use shorthand methods to set properties on the object
    .title('text', 'My fancy chart')
    .colors([
      'red',
      'yellow',
      'blue',
      'green'
    ])
    // 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
    .get();

Summary

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.

API

Check out the API page for complete information.

Development

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

Keywords

highcharts

FAQs

Package last updated on 06 Jan 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts