422
422

Reputation: 5770

Peity Sparklines , customizing

We are using this excellent plugin for some small sparkline charts.

Issue I have is changing colours of the sparklines, sizes etc. The documentation is very brief.

We are using LINE and BAR charts.

Can someone point me in the right direction, please. Or do a quick snippet with custom colours, and size configurations for the sparkline types we need.

http://benpickles.github.com/peity/

Upvotes: 2

Views: 1443

Answers (2)

Igor Kasyanchuk
Igor Kasyanchuk

Reputation: 774

Just in case you need to use a vanilla js version of peity charts - https://github.com/railsjazz/peity_vanilla

Upvotes: 1

dwarfy
dwarfy

Reputation: 3076

Hey, have a look here : http://jsfiddle.net/jpz3m/

Basically you can setup the colors when initializing the plugin :

$(".line").peity("line",{
    colour: "#FF2200",
    strokeColour:"#882200",
    strokeWidth:2,
  }
);

The default options are :

$.fn.peity.defaults.pie = {
  colours: ["#FFF4DD", "#FF9900"],
  delimeter: "/",
  radius: 16
};

$.fn.peity.defaults.line = {
  colour: "#c6d9fd",
  strokeColour: "#4d89f9",
  strokeWidth: 1,
  delimeter: ",",
  height: 16,
  max: null,
  width: 32
};

$.fn.peity.defaults.bar = {
  colour: "#4D89F9",
  delimeter: ",",
  height: 16,
  max: null,
  width: 32
};

Upvotes: 5

Related Questions