Socket
Book a DemoInstallSign in
Socket

chartjs-plugin-style

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chartjs-plugin-style

Chart.js plugin for more styling options

Source
npmnpm
Version
0.3.0
Version published
Weekly downloads
9.1K
7.04%
Maintainers
1
Weekly downloads
 
Created
Source

chartjs-plugin-style

npm Bower Travis Code Climate

Chart.js plugin for more styling options

This plugin requires Chart.js 2.6.0 or later.

Installation

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

To install via npm:

npm install chartjs-plugin-style --save

To install via bower:

bower install chartjs-plugin-style --save

Usage

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

chartjs-plugin-style requires Chart.js. Include Chart.js and chartjs-plugin-style.js to your page to enable style options.

Version 0.3 supports the bevel, drop shadow, inner glow and outer glow effects for datasets and the tooltip. More options are to be added in the upcoming releases.

Tutorial and Samples

You can find a tutorial and samples at nagix.github.io/chartjs-plugin-style.

Configuration

To configure this plugin, you can simply add the following properties to your datasets and tooltip.

Line, Radar and Scatter

NameTypeDefaultDescription
shadowOffsetXNumber0Indicates the horizontal distance the shadow should extend from the line. See MDN.
shadowOffsetYNumber0Indicates the vertical distance the shadow should extend from the line. See MDN.
shadowBlurNumber0Indicates the size of the blurring effect for the line; this value doesn't correspond to a number of pixels. See MDN.
shadowColorColor'rgba(0, 0, 0, 0)'A standard CSS color value indicating the color of the shadow effect for the line. See Colors.
outerGlowWidthNumber0The width of the outer glow effect for the line.
outerGlowColorColor'rgba(0, 0, 0, 0)'The color of the outer glow effect for the line.
pointBevelWidthNumber/Number[]0The width of the bevel effect for the point.
pointBevelHighlightColorColor/Color[]'rgba(0, 0, 0, 0)'The highlight color of the bevel effect for the point.
pointBevelShadowColorColor/Color[]'rgba(0, 0, 0, 0)'The shadow color of the bevel effect for the point.
pointShadowOffsetXNumber/Number[]0The horizontal distance the shadow should extend from the point.
pointShadowOffsetYNumber/Number[]0The vertical distance the shadow should extend from the point.
pointShadowBlurNumber/Number[]0The size of the blurring effect for the point.
pointShadowColorColor/Color[]'rgba(0, 0, 0, 0)'The color of the shadow effect for the point.
pointInnerGlowWidthNumber/Number[]0The width of the inner glow effect for the point.
pointInnerGlowColorColor/Color[]'rgba(0, 0, 0, 0)'The color of the inner glow effect for the point.
pointOuterGlowWidthNumber/Number[]0The width of the outer glow effect for the point.
pointOuterGlowColorColor/Color[]'rgba(0, 0, 0, 0)'The color of the outer glow effect for the point.
pointHoverBevelWidthNumber/Number[]0The width of the bevel effect for the point when hovered.
pointHoverBevelHighlightColorColor/Color[]'rgba(0, 0, 0, 0)'The highlight color of the bevel effect for the point when hovered.
pointHoverBevelShadowColorColor/Color[]'rgba(0, 0, 0, 0)'The shadow color of the bevel effect for the point when hovered.
pointHoverShadowOffsetXNumber/Number[]0The horizontal distance the shadow should extend from the point when hovered.
pointHoverShadowOffsetYNumber/Number[]0The vertical distance the shadow should extend from the point when hovered.
pointHoverShadowBlurNumber/Number[]0The size of the blurring effect for the point when hovered.
pointHoverShadowColorColor/Color[]'rgba(0, 0, 0, 0)'The color of the shadow effect for the point when hovered.
pointHoverInnerGlowWidthNumber/Number[]0The width of the inner glow effect for the point when hovered.
pointHoverInnerGlowColorColor/Color[]'rgba(0, 0, 0, 0)'The color of the inner glow effect for the point when hovered.
pointHoverOuterGlowWidthNumber/Number[]0The width of the outer glow effect for the point when hovered.
pointHoverOuterGlowColorColor/Color[]'rgba(0, 0, 0, 0)'The color of the outer glow effect for the point when hovered.

Bar, Doughnut, Pie, Polar Area and Bubble

NameTypeDefaultDescription
bevelWidthNumber/Number[]0The width of the bevel effect.
bevelHighlightColorColor/Color[]'rgba(0, 0, 0, 0)'The highlight color of the bevel effect.
bevelShadowColorColor/Color[]'rgba(0, 0, 0, 0)'The shadow color of the bevel effect.
shadowOffsetXNumber/Number[]0Indicates the horizontal distance the shadow should extend from the element.
shadowOffsetYNumber/Number[]0Indicates the vertical distance the shadow should extend from the element.
shadowBlurNumber/Number[]0Indicates the size of the blurring effect; this value doesn't correspond to a number of pixels.
shadowColorColor/Color[]'rgba(0, 0, 0, 0)'A standard CSS color value indicating the color of the shadow effect.
innerGlowWidthNumber/Number[]0The width of the inner glow effect.
innerGlowColorColor/Color[]'rgba(0, 0, 0, 0)'The color of the inner glow effect.
outerGlowWidthNumber/Number[]0The width of the outer glow effect.
outerGlowColorColor/Color[]'rgba(0, 0, 0, 0)'The color of the outer glow effect.
hoverBevelWidthNumber/Number[]0The width of the bevel effect when hovered.
hoverBevelHighlightColorColor/Color[]'rgba(0, 0, 0, 0)'The highlight color of the bevel effect when hovered.
hoverBevelShadowColorColor/Color[]'rgba(0, 0, 0, 0)'The shadow color of the bevel effect when hovered.
hoverShadowOffsetXNumber/Number[]0The horizontal distance the shadow should extend from the element when hovered.
hoverShadowOffsetYNumber/Number[]0The vertical distance the shadow should extend from the element when hovered.
hoverShadowBlurNumber/Number[]0The size of the blurring effect when hovered.
hoverShadowColorColor/Color[]'rgba(0, 0, 0, 0)'The color of the shadow effect when hovered.
hoverInnerGlowWidthNumber/Number[]0The width of the inner glow effect when hovered.
hoverInnerGlowColorColor/Color[]'rgba(0, 0, 0, 0)'The color of the inner glow effect when hovered.
hoverOuterGlowWidthNumber/Number[]0The width of the outer glow effect when hovered.
hoverOuterGlowColorColor/Color[]'rgba(0, 0, 0, 0)'The color of the outer glow effect when hovered.

Tooltip

NameTypeDefaultDescription
bevelWidthNumber/Number[]0The width of the bevel effect.
bevelHighlightColorColor/Color[]'rgba(0, 0, 0, 0)'The highlight color of the bevel effect.
bevelShadowColorColor/Color[]'rgba(0, 0, 0, 0)'The shadow color of the bevel effect.
shadowOffsetXNumber0Indicates the horizontal distance the shadow should extend from the tooltip.
shadowOffsetYNumber0Indicates the vertical distance the shadow should extend from the tooltip.
shadowBlurNumber0Indicates the size of the blurring effect; this value doesn't correspond to a number of pixels.
shadowColorColor'rgba(0, 0, 0, 0)'A standard CSS color value indicating the color of the shadow effect.
innerGlowWidthNumber0The width of the inner glow effect.
innerGlowColorColor'rgba(0, 0, 0, 0)'The color of the inner glow effect.
outerGlowWidthNumber0The width of the outer glow effect.
outerGlowColorColor'rgba(0, 0, 0, 0)'The color of the outer glow effect.

For example:

{
    type: 'line',
    data: {
        labels: ['January', 'February', 'March', 'April', 'May', 'June'],
        datasets: [{
            data: [45, 20, 64, 32, 76, 51],
            shadowOffsetX: 3,
            shadowOffsetY: 3,
            shadowBlur: 10,
            shadowColor: 'rgba(0, 0, 0, 0.5)',
            pointBevelWidth: 3,
            pointBevelHighlightColor: 'rgba(255, 255, 255, 0.75)',
            pointBevelShadowColor: 'rgba(0, 0, 0, 0.5)',
            pointShadowOffsetX: 3,
            pointShadowOffsetY: 3,
            pointShadowBlur: 10,
            pointShadowColor: 'rgba(0, 0, 0, 0.5)',
            pointHoverInnerGlowWidth: 20,
            pointHoverInnerGlowColor: 'rgba(255, 255, 0, 0.5)',
            pointHoverOuterGlowWidth: 20,
            pointHoverOuterGlowColor: 'rgba(255, 255, 0, 1)'
        }]
    },
    options: {
        tooltips: {
            bevelWidth: 3,
            bevelHighlightColor: 'rgba(255, 255, 255, 0.75)',
            bevelShadowColor: 'rgba(0, 0, 0, 0.5)'
            shadowOffsetX: 3,
            shadowOffsetY: 3,
            shadowBlur: 10,
            shadowColor: 'rgba(0, 0, 0, 0.5)'
        }
    }
}

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 watch      # watch for changes and build automatically
gulp lint       # perform code linting
gulp package    # create an archive with dist files and samples

License

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

Keywords

chart.js

FAQs

Package last updated on 23 Jul 2018

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