Skip to content
Advertisement

Chart Js clickable bar

I want to make my chart js bar clickable. I want to add click features such as links. No idea how to proceed. Have read documentation times 10…

JavaScript

Advertisement

Answer

If you are using chart.js version 2.4+ (maybe earlier), there is a onclick event that is very useful. I’m using it on a stacked bar chart, so it should work for you too. You can find it under common chart configuration in the documentation. (See: https://www.chartjs.org/docs/latest/charts/bar.html#stacked-bar-chart)

JavaScript

Hope this helps.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement