Skip to content

Instantly share code, notes, and snippets.

@cpsievert
Last active February 6, 2020 17:53
Show Gist options
  • Save cpsievert/a6015fd914d1b4b7ac201e99a4234bd1 to your computer and use it in GitHub Desktop.
Save cpsievert/a6015fd914d1b4b7ac201e99a4234bd1 to your computer and use it in GitHub Desktop.

It appears plotly.js 1.50.0 introduced the following error in phantomjs 2.1.1:

$ phantomjs --version
2.1.1
$ phantomjs plot.js
This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.


  https://cdn.plot.ly/plotly-1.50.0.min.js:7
TypeError: undefined is not a constructor (evaluating 'Object.setPrototypeOf(e.prototype,Uint8Array.prototype)')

  https://cdn.plot.ly/plotly-1.50.0.min.js:7
ReferenceError: Can't find variable: Plotly
<head>
<!-- Plotly.js -->
<script src="https://rawgit.com/plotly/plotly.js/master/dist/extras/typedarray.min.js"></script>
<script src="https://cdn.plot.ly/plotly-1.50.0.min.js"></script>
</head>
<body>
<div id="graph"></div>
<script>
var dat = [{
"x": [1,2],
"y": [1,2]
}];
var gd = document.getElementById("graph");
Plotly.plot(gd, dat);
</script>
</body>
<script src="https://cdn.plot.ly/plotly-1.50.0.min.js"></script>
</head>
<body>
<div id="graph"></div>
<script>
var dat = [{
"x": [1,2],
"y": [1,2]
}];
var gd = document.getElementById("graph");
Plotly.plot(gd, dat);
</script>
</body>
var page = require('webpage').create();
page.open('plot.html', function() {
page.render('plot.png');
phantom.exit();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment