-
Notifications
You must be signed in to change notification settings - Fork 11.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEATURE] Add link to point or label #4639
Comments
@zeckart what kind of link are you looking to add? |
@etimberg a link to an other page |
@zeckart see http://www.chartjs.org/docs/latest/general/interactions/events.html#events and http://www.chartjs.org/docs/latest/developers/api.html#getelementsatevente code example: var cv = document.getElementById('chartJSContainer')
var ctx = cv.getContext('2d');
var chart = new Chart(ctx, options);
cv.onclick = function(evt){
var activePoint = chart.getElementAtEvent(evt);
console.log('activePoint', activePoint)
// var url = ... make link with data from activePoint
window.location = 'https://www.google.by/search?q=chart+js+events&oq=chart+js+events'
}; |
@rmaksim's answer has the best solution. Since everything is on canvas, you'll need to do the hit detection yourself. |
Thank's a lot for your help I'm done with that, here is a fiddle: |
Sorry to be a bother, but has this been integrated into ChartJs? It would be great if there was an easy way to associate a point in chart with a url anchor. Even better if we could create a generic code from the point that would be a value in the url. Is there any hope of this? |
Note - the method has been renamed from |
Hello,
Is there any way to add a link on a point of a line chart ?
The text was updated successfully, but these errors were encountered: