Skip to content

Cannot draw a simple plot: Uncaught TypeError: Cannot read property 'style' of undefined #238

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

Closed
gramster opened this issue Feb 4, 2016 · 3 comments

Comments

@gramster
Copy link

gramster commented Feb 4, 2016

I'm trying to draw a simple heatmap with 1.5.1, but am getting this error.

Uncaught TypeError: Cannot read property 'style' of undefined

It seems to be coming from:

function lsInner(gd) {
    var fullLayout = gd._fullLayout,
        gs = fullLayout._size,
        axList = Plotly.Axes.list(gd),
        i;

    // clear axis line positions, to be set in the subplot loop below
    for(i = 0; i < axList.length; i++) axList[i]._linepositions = {};

    fullLayout._paperdiv
         .style({
            width: fullLayout.width + 'px',
            height: fullLayout.height + 'px'
        })
        .selectAll('.main-svg')
            .call(Drawing.setSize, fullLayout.width, fullLayout.height);

In my case fullLayout has no property named _paperdiv.

@gramster
Copy link
Author

gramster commented Feb 4, 2016

Repro: https://jsfiddle.net/x3srtdjg/1/

@gramster
Copy link
Author

gramster commented Feb 4, 2016

Ah, my bad - didn't notice data needed to be an array. Adding [] around it fixes problem.

@etpinard
Copy link
Contributor

etpinard commented Feb 4, 2016

Duplicate of #167

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