chartjs-node-plugin-colorschemes

1.2.0 • Public • Published

chartjs-node-plugin-colorschemes

This is a nodejs compatible fork of chartjs-plugin-colorschemes, which basically just converts the ES6 modules to CommonJS modules, and changes the API somewhat, so that it can be used server-side with packages like chartjs-node.

Usage

To register the plugin to chartjs-node, use the following:

const colorschemes = require('chartjs-node-plugin-colorschemes');
 
const chart = new ChartjsNode(parsed.dimensions.width, parsed.dimensions.height);
 
chart.on('beforeDraw', (instance) => {
    colorschemes(instance);
});

You can then pass the desired color scheme in the chartjs configuration like so:

{
    "options": {
        "plugins": {
            "colorschemes": {
                "scheme": "brewer.Spectral11"
            }
        }
    }
}

See the chartjs-plugin-colorschemes website for more usage information and a list of available color schemes.

License

chartjs-plugin-colorschemes is available under the MIT license.

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i chartjs-node-plugin-colorschemes

      Weekly Downloads

      6

      Version

      1.2.0

      License

      MIT

      Unpacked Size

      53.7 kB

      Total Files

      11

      Last publish

      Collaborators

      • intranetfactory
      • olliejm