Hello!
I need change dougnut segment color on click. I try to use onClick event for this purpose. But settting of new backgroundColor has no effect on chart. I'm not sure, that my way is correct. But I guess, there is no such feature in chart.js.
There is my event handler:
options: {
onClick: function(evt, elements) {
if (elements && elements.length) {
console.log(elements[0]._model.backgroundColor);
//elements[0]._model.backgroundColor = "#ff9933" - it doesn't work
}
}
}
Here is my plunk for convenience.
Thanks!
@greatromul here's how to do it: http://plnkr.co/edit/ESLfihjIYRNLFjFpk5Jd?p=preview
@etimberg Great Job, with it!!
But there is some issue, unable to remove label from legends which works fine otherwise
Most helpful comment
@greatromul here's how to do it: http://plnkr.co/edit/ESLfihjIYRNLFjFpk5Jd?p=preview