Skip to content
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

Angular 7 Cannot read property 'refresh' of undefined #80

Closed
gornad opened this issue Jun 10, 2019 · 3 comments
Closed

Angular 7 Cannot read property 'refresh' of undefined #80

gornad opened this issue Jun 10, 2019 · 3 comments

Comments

@gornad
Copy link

gornad commented Jun 10, 2019

Hello,
I just started using this plugin and upon running npm install and importing, I am met with this error:

DashboardComponent_Host.ngfactory.js? [sm]:1 ERROR TypeError: Cannot read property 'refresh' of undefined
at resolveOption (chartjs-plugin-streaming.js:139)
at startDataRefreshTimer (chartjs-plugin-streaming.js:254)
at ChartElement.initialize (chartjs-plugin-streaming.js:405)
at ChartElement.Element (Chart.js:2747)
at ChartElement [as constructor] (Chart.js:1971)
at ChartElement [as constructor] (Chart.js:1971)
at new ChartElement (Chart.js:1971)
at Chart.js:8620
at Object.each (Chart.js:1801)
at Chart.buildOrUpdateScales (Chart.js:8599)

I am clueless as to how to proceed with resolving this. I have the latest versions of moment.js and chart.js. I imported this way into the .ts file where streaming is needed:
import 'chartjs-plugin-streaming';
import * as moment from 'moment';
Any help would be very much appreciated.
Thanks.

@gornad gornad closed this as completed Jun 11, 2019
@gornad gornad reopened this Jun 11, 2019
@gornad
Copy link
Author

gornad commented Jun 12, 2019

It turns out that the bug occurs when a chart with type 'time' is present without a streaming: false flag.

@gornad gornad closed this as completed Jun 12, 2019
@koderi-dp
Copy link

koderi-dp commented Oct 8, 2019

streaming: false

Hi, where did you set that options, tried everything but still not working

@gornad
Copy link
Author

gornad commented Oct 9, 2019

This was a while ago, but in my case, the bug occurred when I had a chart with type time and did not specify if it was streaming or not. So, when you instantiate the chart, in the options property options { }, you add
plugins: {
streaming: false,
},

Hope this helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants