-
-
Notifications
You must be signed in to change notification settings - Fork 837
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
Use Reactive Data with <script> version of vue-chartjs #107
Comments
Hello @yomete yeah it is possible. You simply use it, without the imports :D The only thing you need to do is to add the mixin to your chart component ...
mixins: [VueChartJs.mixins.reactiveProp]`
... |
Awesome! Thanks @apertureless Although, I still couldn't get the chart to work. I tried using the Reactive Data example in the docs. |
Vue mixins has to be passed as an array. |
Nah, the mixin will create the Vue.component('line-chart', {
extends: VueChartJs.Line,
mixins: [VueChartJs.mixins.reactiveProp],
props: ['chartData', 'options'],
mounted () {
console.log(this.chartData)
this.renderChart(this.chartData, this.options)
}
}) @euledge you are also not passing the mixin as an array :D So if you would have a button to randomize the data, it would also not work ;) Your example is working because the computed property is generating the data before the chart gets rendered. So its likeley the same as defining the random data on the data model. |
@apertureless Thank you for correcting errors in recognition. |
@apertureless @euledge Awesome! Got it to work! Thanks guys 😄 |
Both are right. You can initiate |
Hey @apertureless So I asked the question above because I was writing an article on vue-chartjs. I'm done with it and you can read here |
This should be added to the documentation. |
@CyrusTheVirusG What exactly? It is mentioned in the docs, that the mixin is creating the props itself: https://vue-chartjs.org/guide/#updating-charts |
Hello,
So I want to use the reactive data feature on my chart. But the problem is, I'm building the Vue app via the
<script>
method (intentionally). No webpack/babel/ES6 involved.The example in the docs only demonstrates how to implement with ES6. How do I implement Reactive Data in an environment without ES6 and imports? Is it possible?
The text was updated successfully, but these errors were encountered: