Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

chartjs-node-plugin-colorschemes

adenin-platform85MIT1.2.0

Nodejs compatible fork of chartjs-plugin-colorschemes

chart.js, plugin, color, scheme, palette, brewer, office, tableau

readme

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.