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
[BUG] TypeError: Cannot read property of '_meta' of undefined #4978
Comments
What is the content of your |
@Enishowk is right. Your var newData = [{data: [1,2,3], label: 'data-label'}, null, 1, 'abc', undefined];
newData = newData.filter(function(val) {
return val !== undefined
&& val !== null
&& typeof val === 'object'
&& val.hasOwnProperty('data');
});
>>> newData = [{data: [1,2,3], label: 'data-label'}] |
@8 did you fix it? If not, can you post a jsfiddle that reproduces this issue? |
I was able to produce a similar error message by passing a plot point with the y axis value set to undefined: var plotPoints = []
for(var i = 0; i < 100; i++){
plotPoints.push({
x: 1,
y: undefined
});
} Yields: "TypeError: can't assign to property "_meta" on "1000": not an object" I think that ChartJS should produce a sensible error message in this case. Maybe an exception: |
I was able to fix it by adding the following line in node_modules/chart.js/src/core/core.controller.js `
|
We're also seeing this issue. We are doing a lot of changes regarding axes, labels and dataset together with chart animation. I'v read that between options and data changes, you need to update the chart, so I did this. Furthermore, before each update I did this
I've also printed out a console error if a dataset is null or undefined before updating which never happens. This is not 100% reproducible. I've now written an automated E2E test which artificially increased animation time (5s), even in that case, I can only reproce it in 50% of the test runs. |
I could reproduce this issue with Chart.js 2.6.0 and 2.7.0. Visit https://jsfiddle.net/nagix/hmkftj7L/, hover over the top left point in blue and wait for 5 seconds. After the blue line disappears, you will see this error if you move your pointer. This issue was already fixed in #4840, and the fix is included in 2.7.1. Looking at the stack trace, this happened in an event loop, so it seems to me that these are the same issue. @jwedel What version are you using? Can you share the stack trace of the error? |
@nagix We're using 2.7.3 and recently switched to 2.8.0. This is the stack trace:
This issue was caused after calling From the docs it's not 100% clear if stacked changes can be done with a single update afterwards or not. |
How can we update getDatasetMeta: function(datasetIndex) method in chart.js? |
So I got this error due to a misunderstanding while using ChartJS within ReactJS itself (not the
|
I also sow this issue. |
@mashaod 's solution solved the issue in my case. |
I am facing the same issue when I pass an onClick event to legend. This is what I have done for one of my charts within my class. Can someone help?
The name of my chart is myChart.
|
Still happening in the latest code from master https://jsfiddle.net/4kmw3spf/1/ |
But you will lose once send to QA or prod or if npm version is updated. |
hello, has your problem been solved, I have the same problem as you |
Expected Behavior
No error occurs.
Current Behavior
A linear chart is continuously updated every couple of seconds by assigning to it's datasets and labels property before calling the update method using the following code:
After some hours of normal behavior an exception occurs in production:
The stack trace points toward a bug inside Chart.js.
Possible Solution
Unknown.
Steps to Reproduce (for bugs)
I was unable to reproduce it in a development environment, it only happends sporadically in production after hours of usage.
Context
The chart is used inside a monitoring application based on angular and contiuously updated.
It looks like an uncaught exception inside of Chart.js, which is crashing the application.
Environment
The text was updated successfully, but these errors were encountered: