chartist-plugin-legend
Implements a legend for Chartist charts.
Install
$ npm install chartist-plugin-legend --save
As styles are very different with each project, no CSS is included. You can copy paste this to use as base:
.ct-legend
Usage
In an example chart:
; '.ct-chart' data stackBars: true plugins: Chartistplugins };
Option | Description | Type | Default |
---|---|---|---|
className |
Adds a class to the ul element. |
string |
'' |
clickable |
Sets the legends clickable state; setting this value to false disables toggling graphs on legend click. |
bool |
true |
legendNames |
Sets custom legend names. By default the name property of the series will be used if none are given. |
mixed |
false |
onClick |
Accepts a function that gets invoked if clickable is true. The function has the chart , and the click event (e ), as arguments. |
mixed |
false |
classNames |
Accepts a array of strings as long as the chart's series, those will be added as classes to the li elements. |
mixed |
false |
removeAll |
Allow all series to be removed at once. | bool |
false |
position |
Sets the position of the legend element. top , bottom or any DOM2 Element are currently accepted. If a DOM Element is given, the legend will be appended as it's last child. |
'top'|'bottom'|HTMLElement |
'top' |