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>
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]]]
The error
code: