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

TypeError: Cannot read property 'null' of undefined #2604

Closed
haschu opened this issue May 19, 2016 · 3 comments
Closed

TypeError: Cannot read property 'null' of undefined #2604

haschu opened this issue May 19, 2016 · 3 comments

Comments

@haschu
Copy link
Contributor

haschu commented May 19, 2016

I couldn't reproduce the issue in a plunk, therefore I made a screenshot from the browser console:

bildschirmfoto 2016-05-19 um 22 33 15

This happens for some reasons in one of our projects.

The problem is in scale.time.js:

getPixelForTick: function(index, includeOffset) {
    return this.getPixelForValue(this.tickMoments[index], null, null, includeOffset);
},

null,null is passed to: this.getLabelMoment(datasetIndex, index); here:

getPixelForValue: function(value, index, datasetIndex, includeOffset) {
    var labelMoment = value && value.isValid && value.isValid() ? value : this.getLabelMoment(datasetIndex, index);

and then this.labelMoments[null][null] failed:

getLabelMoment: function(datasetIndex, index) {
    return this.labelMoments[datasetIndex][index];
}

Going to post a pull request for that tomorrow.

@zpriddy
Copy link

zpriddy commented Jun 12, 2016

This happens no matter what i set the value in getPixelForValue on line 169

chart_test.txt

@zpriddy
Copy link

zpriddy commented Jun 12, 2016

So this seems to work:

ctx.fillRect(xaxis.getPixelForValue("THIS IS IGNORED",13,1), yaxis.top, xaxis.getPixelForValue("THIS IS IGNORED",10,1)-xaxis.getPixelForValue("THIS IS IGNORED",13,1), yaxis.bottom);

So you have to do getPixelForValue("THIS DOESN'T MATTER", , )

Ideally we should be able to call getPixelForValue( new Date [.....])

@haschu
Copy link
Contributor Author

haschu commented Jun 14, 2016

@zpriddy Sorry, I forgot about this issue. I'm going to post a pull request with a fix as soon as I can.

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

No branches or pull requests

3 participants