Skip to content

nigelflippo/chartist-plugin-gradient

Repository files navigation

Area Gradient plugin for Chartist.js

This is a plugin for Chartist.js that will append a gradient to your line chart that spans opposite directions relative to a baseline threshold.

Gradient Example Screenshot

Download

npm install --save chartist-plugin-gradient

Available options and their defaults

var defaultOptions = {
  threshold: 0;
};

Sample usage in Chartist.js

import ctAreaGradient from 'chartist-plugin-gradient';

var chart = new Chartist.Line('.ct-chart', {
  series: [
    [1, 5, -3, 4, -6, 2, -3, 0]
  ]
}, {
  showArea: true,
  areaBase: 0,
  plugins: [
    ctAreaGradient({
      threshold: 0
    })
  ]
});
.ct-base-above, .ct-base-below {
  fill: #000;
}

About

Plugin for the Chartist library, applies a gradient color relative to line chart baseline.

Resources

License

Stars

Watchers

Forks

Packages

No packages published