Skip to content

Commit

Permalink
Merge 7b072ce into 13d2fdb
Browse files Browse the repository at this point in the history
  • Loading branch information
hellodavecooper committed Apr 5, 2016
2 parents 13d2fdb + 7b072ce commit f5712be
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,4 @@ new Chartist.Bar('.ct-chart', data, {
| `className` | Add extra classes. | `string` | `''` |
| `clickable` | Make the legend items clickable; when clicked the corresponding series will disappear. | `bool` | `true` |
| `legendNames` | Use custom names for the legend. By default the `name` property of the series will be used (for charts labels will be used) | `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` |
7 changes: 6 additions & 1 deletion chartist-plugin-legend.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
var defaultOptions = {
className: '',
legendNames: false,
clickable: true
clickable: true,
onClick: null
};

Chartist.plugins = Chartist.plugins || {};
Expand Down Expand Up @@ -114,6 +115,10 @@
seriesCopy.splice(series, 1);
});

if (options.onClick) {
options.onClick(chart, e);
}

chart.data.series = seriesCopy;

chart.update();
Expand Down

0 comments on commit f5712be

Please sign in to comment.