Skip to content

Can't register module scatter3d #2502

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
ndabAP opened this issue Mar 27, 2018 · 8 comments
Closed

Can't register module scatter3d #2502

ndabAP opened this issue Mar 27, 2018 · 8 comments

Comments

@ndabAP
Copy link

ndabAP commented Mar 27, 2018

Browser: Chrome 65
Device: Desktop
Plotly.js version: 1.35.2

Problem: It's not possible to use Plotly.register(require('plotly.js/lib/scatter3d')) to show up 3d charts. Error message appears:

Webgl is not supported by your browser

And console logs

app.bundle.js:8 Uncaught TypeError: Cannot read property 'canvas' of undefined

Using the same set-up and registering the bar components works fine. Repository for reproduction: https://github.com/ndabAP/plotly.js-scatter3d-issue/tree/master

Steps to reproduce:

  1. $ npm i
  2. Open file dist/index.html. You should see a bar chart
  3. Comment out line 20-21 and comment in line 6-17
  4. $ npm run build
  5. Open the file dist/index.html again. The error appears

When I import the whole Plotly.js library instead of registering the single chart components the 3d chart works fine.

@etpinard
Copy link
Contributor

What browser are you using?

@ndabAP
Copy link
Author

ndabAP commented Mar 27, 2018

Using Chrome but just tested it with Firefox: Same issue (both desktop).

@etpinard
Copy link
Contributor

... which version of Chrome and Firefox? This is very important. WebGL (and thus scatter3d) isn't support in all browsers. If you browser doesn't support WebGL there's not much we can do.

You can navigate to https://get.webgl.org/ to check whether your browser supports WebGL.

@ndabAP
Copy link
Author

ndabAP commented Mar 27, 2018

Newest versions (65.0.3325.181 for Chrome).

When I require the whole Plotly.js library, I can see the 3 d chart without problems.

@etpinard
Copy link
Contributor

etpinard commented Mar 27, 2018

In your https://github.com/ndabAP/plotly.js-scatter3d-issue/tree/master your webpack config is missing the ify-loader rule. Please see https://github.com/plotly/plotly.js#building-plotlyjs-with-webpack for more info on custom bundling with webpack.

@ndabAP
Copy link
Author

ndabAP commented Mar 27, 2018

You're right. I added the ify-loader but the error still appears.

https://github.com/ndabAP/plotly.js-scatter3d-issue/blob/master/webpack.config.js#L24

@etpinard
Copy link
Contributor

Your config isn't right yet (I think, I'm no webpack expert). You do need to use ify-loaded on node_modules files. That is, that exclude: /(node_modules|bower_components)/, line seems off.

See full example here: https://github.com/plotly/plotly-webpack/blob/master/webpack.config.js

@ndabAP
Copy link
Author

ndabAP commented Mar 27, 2018

That did it. Sorry for bothering you. Should more rely on documentation ;) Have a nice day!

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