-
-
Notifications
You must be signed in to change notification settings - Fork 831
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
How can I access the vue component instance inside callback of options.tooltips? #475
Comments
Well, this has nothing to to with either chart.js or vue-chartjs. There are enough resources and tutorials on how to handle The easiest way is to use arrow functions or |
@theenadayalank - did you get a chance to implement this? if so, would you mind sharing the code. |
¯_(ツ)_/¯ Just like I said:
https://codepen.io/apertureless/pen/BZKBdX Instead of label: function(tooltipItem,data){} use label: (tooltipItem, data) => {
} |
@apertureless it helped, thank you! quick question - i see you are passing currency prop in your example with options. I need to pass another prop to component but for datacollection calculations without passing whole data prop itself. Would you mind sharing what is the best way to do this? let me know if you want me to share the code. |
I don't really understand what you want to achieve. |
@apertureless from your example: https://codepen.io/apertureless/pen/BZKBdX |
This will not work. You can't access props in your data. |
@apertureless any plans/workaround to improve this? the use case for your example would be - i have the same chart for different currencies and i want to derive data in my datacollection based on the prop as the filter and show all charts on the same page: |
Hi @apertureless - any word on this one? it doesn't look efficient to duplicate datacollection multiple times just because we can't pass this prop to filter the data. I am sure there is a way to do it more efficient - i just don't know it and i guess you are the best person to help with it :) |
First of all, Thank You for this wonderful package 😍 . This package made my day ❤️ .
I'm in a situation where I need to construct the tooltip data using props. So I have used
tooltips.callbacks.label
option referred from docs.Inside the
label: function(tooltipItem,data){}
I need to use props passed from the parent component, but what I'm getting is tooltip instance forthis
(As per the docs).Is there any way to get VueComponet instance inside that function? Thanks in Advance 😃
Environment
^2.5.16
^3.4.0
6.4.1
The text was updated successfully, but these errors were encountered: