All Projects โ†’ nagix โ†’ Chartjs Plugin Colorschemes

nagix / Chartjs Plugin Colorschemes

Licence: mit
Predefined color schemes for Chart.js

Programming Languages

javascript
184084 projects - #8 most used programming language
scheme
763 projects

Projects that are alternatives of or similar to Chartjs Plugin Colorschemes

Xcodecolorsense
๐ŸŽˆ An Xcode plugin that makes working with color easier
Stars: โœญ 79 (-58.2%)
Mutual labels:  plugin, palette, color
Colorpicker
jQuery UI widget for color picking (similar to the one in Microsoft Office 2010).
Stars: โœญ 271 (+43.39%)
Mutual labels:  office, palette, color
R Color Palettes
Comprehensive list of color palettes available in r โค๏ธ๐Ÿงก๐Ÿ’›๐Ÿ’š๐Ÿ’™๐Ÿ’œ
Stars: โœญ 708 (+274.6%)
Mutual labels:  palette, color
Iro.js
๐ŸŽจ Modular color picker widget for JavaScript, with support for a bunch of color formats
Stars: โœญ 796 (+321.16%)
Mutual labels:  plugin, color
Chartjs Plugin Rough
Chart.js plugin to create charts with a hand-drawn, sketchy, appearance
Stars: โœญ 59 (-68.78%)
Mutual labels:  plugin, chartjs
Chartjs Plugin Datalabels
Chart.js plugin to display labels on data elements
Stars: โœญ 545 (+188.36%)
Mutual labels:  plugin, chartjs
Alembic
โš—๏ธ Extract a color palette from Sketch images
Stars: โœญ 565 (+198.94%)
Mutual labels:  palette, color
Kirby Color Palette
A color palette to pick colors from in the panel. Kirby 3 only.
Stars: โœญ 47 (-75.13%)
Mutual labels:  palette, color
Picassopalette
Android Lollipop Palette is now easy to use with Picasso !
Stars: โœญ 366 (+93.65%)
Mutual labels:  palette, color
Color Names
Large list of handpicked color names ๐ŸŒˆ
Stars: โœญ 1,198 (+533.86%)
Mutual labels:  palette, color
Chartjs Plugin Dragdata
Draggable data points plugin for Chart.js
Stars: โœญ 116 (-38.62%)
Mutual labels:  plugin, chartjs
Sketch swatches
A swatches plugin for Sketch.
Stars: โœญ 446 (+135.98%)
Mutual labels:  palette, color
Chartjs Plugin Zoom
Zoom and pan plugin for Chart.js
Stars: โœญ 404 (+113.76%)
Mutual labels:  plugin, chartjs
Nord Tmux
An arctic, north-bluish clean and elegant tmux color theme.
Stars: โœญ 567 (+200%)
Mutual labels:  plugin, color
Chartjs Plugin Annotation
Annotation plugin for Chart.js
Stars: โœญ 389 (+105.82%)
Mutual labels:  plugin, chartjs
Color.js
Extract colors from an image (0.75 KB) ๐ŸŽจ
Stars: โœญ 42 (-77.78%)
Mutual labels:  palette, color
Glidepalette
Android Lollipop Palette is now easy to use with Glide
Stars: โœญ 1,670 (+783.6%)
Mutual labels:  palette, color
Coolhue
Coolest Gradient Hues and Swatches
Stars: โœญ 3,307 (+1649.74%)
Mutual labels:  palette, color
Huebee
๐Ÿ 1-click color picker
Stars: โœญ 332 (+75.66%)
Mutual labels:  plugin, color
Chartjs Plugin Deferred
Chart.js plugin to defer initial chart updates
Stars: โœญ 65 (-65.61%)
Mutual labels:  plugin, chartjs

chartjs-plugin-colorschemes

npm Bower Travis Coverage Maintainability Awesome

Predefined color schemes for Chart.js

You can pick the perfect color combination for your charts from the predefined color schemes, which are based on popular tools such as ColorBrewer, Microsoft Office and Tableau.

This plugin requires Chart.js 2.5.0 or later.

Installation

You can download the latest version of chartjs-plugin-colorschemes from the GitHub releases.

To install via npm:

npm install chartjs-plugin-colorschemes --save

To install via bower:

bower install chartjs-plugin-colorschemes --save

To use CDN:

<script src="https://cdn.jsdelivr.net/npm/chartjs-plugin-colorschemes"></script>
<script src="https://unpkg.com/chartjs-plugin-colorschemes"></script>

Usage

chartjs-plugin-colorschemes can be used with ES6 modules, plain JavaScript and module loaders.

Include Chart.js and chartjs-plugin-colorschemes.js to your page, and specify a color scheme as shown in the example below. You can pick a scheme from Color Chart.

    options: {
        plugins: {
            colorschemes: {
                scheme: 'brewer.Paired12'
            }
        }
    }

Every color scheme has a number at the end of its name, which indicates the number of that colors included in the scheme. If the number of the datasets is larger than it, the same colors will appear repeatedly. A color is not modified if it is specified by dataset options.

Usage in ES6 as Module

Nothing else than importing the module should be enough.

import 'chartjs-plugin-colorschemes';

If you want to reduce the size by only importing the plugin core and particular color schemes, see the example below.

// import the plugin core
import 'chartjs-plugin-colorschemes/src/plugins/plugin.colorschemes';

// import a particular color scheme
import { Aspect6 } from 'chartjs-plugin-colorschemes/src/colorschemes/colorschemes.office';

// ...
    options: {
        plugins: {
            colorschemes: {
                scheme: Aspect6
            }
        }
    }
//...

Tutorial

You can find a tutorial at nagix.github.io/chartjs-plugin-colorschemes.

Configuration

The plugin options can be changed at 2 different levels and with the following priority:

  • per chart: options.plugins.colorschemes.*
  • globally: Chart.defaults.global.plugins.colorschemes.*

All available options are listed below.

Name Type Default Description
fillAlpha number 0.5 The transparency value for the line fill color. Must be a number between 0.0 (fully transparent) and 1.0 (no transparency).
scheme string|string[] 'brewer.Paired12' Color scheme name that is any of Color Chart. It also accepts an array of color strings, which is primarily for ES modules. more...
reverse boolean false If set to true, the order of the colors in the selected scheme is reversed.
override boolean false If set to true, the specified color scheme will override the existing color options. If false, it is only applied when no color setting exists. more...
custom function undefined A function that takes a copy of the color string array for scheme in order to extend the predefined scheme colors. more...

Overriding Existing Color Settings

By default, this plugin doesn't apply a color scheme if any color options are already specified. This may cause a problem if you are using a third party library such as ng-charts, which automatically applies default color settings. In that case, the existing color settings can be overridden by setting the override option to true.

custom-Function

With the help of the custom-Function you can extend the predefined scheme colors. This function takes a copy of the current scheme and is expected to return an array with at least one element. See the example below.

var customColorFunction = function(schemeColors) {
    var myColors = ['#ff0000', '#00ff00', '#0000ff']; // define/generate own colors

    // extend the color scheme with own colors
    Array.prototype.push.apply(schemeColors, myColors);

    return schemeColors; // optional: this is not needed if the array is modified in place
};

// ...
    options: {
        plugins: {
            colorschemes: {
                scheme: 'brewer.Paired12',
                custom: customColorFunction
            }
        }
    }
//...

Building

You first need to install node dependencies (requires Node.js):

npm install

The following commands will then be available from the repository root:

gulp build            # build dist files
gulp build --watch    # build and watch for changes
gulp test             # run all tests
gulp test --watch     # run all tests and watch for changes
gulp test --coverage  # run all tests and generate code coverage
gulp lint             # perform code linting
gulp package          # create an archive with dist files and samples

License

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].