-
Notifications
You must be signed in to change notification settings - Fork 33
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 to redraw chart on window resize #5
Comments
Hmm. Good question. Right now, In the meantime, you can call the
And then in the Vue instance: var yoyo = new Vue({
el: 'app',
data: function () {
return {
columns: [{
'type': 'string',
'label': 'Year'
}, {
'type': 'number',
'label': 'Sales'
}, {
'type': 'number',
'label': 'Expenses'
}],
rows: [
['2004', 1000, 400],
['2005', 1170, 460],
['2006', 660, 1120],
['2007', 1030, 540]
],
options: {
title: 'Company Performance',
hAxis: {
title: 'Year',
minValue: '2004',
maxValue: '2007'
},
vAxis: {
title: '',
minValue: 300,
maxValue: 1200
},
height: 500,
curveType: 'function'
}
}
},
})
jQuery(window).resize(function () {
yoyo.$refs.thisherechart.drawChart();
}); Thanks for bringing this to my attention, I'll try and make sure the next release has something to make tasks like this easier. |
I tried this method but I got an error. Uncaught TypeError: Cannot read property 'drawChart' of undefined |
You have to use the Child Component Ref for the vue-charts component, then call |
How to achive this with single file components?
I've tried using
or
|
In the example I gave, I assigned my Vue component to the
And then I used the
You have to call it on the Vue instance. You should still be able to declare it within the component. Can you paste the script portion of your single file component? |
I don't create vue object explicitly so I cant gave it a name. |
Ahh, I see. Try putting the jQuery part inside of your |
no success:
|
works fine. |
No, not stupid at all! Glad you got it figured out :) |
how to redraw chart on window resize
The text was updated successfully, but these errors were encountered: