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

Uncaught TypeError: ..... Value is not of type 'long'. #189

Open
rsa408 opened this issue Apr 8, 2022 · 1 comment
Open

Uncaught TypeError: ..... Value is not of type 'long'. #189

rsa408 opened this issue Apr 8, 2022 · 1 comment

Comments

@rsa408
Copy link

rsa408 commented Apr 8, 2022

The error

Uncaught TypeError: Failed to execute 'getImageData' on 'CanvasRenderingContext2D': Value is not of type 'long'.
    at getTextInfo (wordcloud2.js:633:28)
    at putWord (wordcloud2.js:933:18)
    at Array.loop (wordcloud2.js:1199:21)
    at setZeroTimeoutMessage (wordcloud2.js:53:22)

code:

 <canvas id="canvas"></canvas>
           
           <script>              
            tagList=document.getElementById('userlable').textContent // => gets array
                    console.log(tagList);
           WordCloud(document.getElementById('canvas'), {
                list: tagList,
                fontFamily: 'Times, serif',
                fontWeight: 'normal',
                color: 'random-dark',
                minSize: 0, // 0 to disable
                weightFactor: 20,
                clearCanvas: true,
                backgroundColor: '#fff', // opaque white = rgba(255, 255, 255, 1)
                gridSize: 10,
                drawOutOfBound: false,
                shrinkToFit: false,
                origin: null, // origin of the “cloud” in [x, y]
                drawMask: false, // visualize the grid
                maskColor: 'rgba(255,0,0,0.3)',
                maskGapWidth: 0.3,
                wait: 0,
                abortThreshold: 0, // disabled
                abort: function noop() { },
                minRotation: -Math.PI / 2,
                maxRotation: Math.PI / 2,
                rotationSteps: 0,
                shuffle: true,
                rotateRatio: 0.1,
                // circle, cardioid, diamond, square, triangle-forward, 
                // triangle, pentagon, and star
                shape: 'circle',
                ellipticity: 0.65,
                // allows the user to define the class of the span elements
                classes: null,
                // callback
                hover: null,
                click: null
            });
        </script>
       
@vitsumoc
Copy link

vitsumoc commented Dec 4, 2023

maybe you should check your array tagList
it should be a two-level array
[["for", 12], ["bar", 6]]
not a three-level array
[[["for", 12], [ "bar", 6]]]

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