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

Custom Partial Bundle - Scatter3d - Not working. #5031

Closed
mithi opened this issue Jul 30, 2020 · 3 comments
Closed

Custom Partial Bundle - Scatter3d - Not working. #5031

mithi opened this issue Jul 30, 2020 · 3 comments

Comments

@mithi
Copy link

mithi commented Jul 30, 2020

I'm trying to load my own custom partial bundle, because I only need the Scatter3d. I was not successful. There might be a bug which might be related to issue: -#4883

Here's the code sandbox link and screenshot.

Screen Shot 2020-07-30 at 7 37 51 PM

I found these related issues to help me with this

Here's the sandbox of my actual project which is working fine currently because i'm using the plotly partial bundle (OK)

Screen Shot 2020-07-30 at 9 15 26 PM

Here's the sandbox where I'm using a custom partial bundle (NOT OK)

Screen Shot 2020-07-30 at 9 21 25 PM

This is the only difference between the two:

import Plotly from "plotly.js/lib/core";
import Scatter3d from "plotly.js/lib/scatter3d"
import createPlotlyComponent from "react-plotly.js/factory";
Plotly.register([Scatter3d]);

const CustomPlotly = createPlotlyComponent(Plotly);
export default CustomPlotly;

Console log errors when running on local

react_devtools_backend.js:2273 WARN: webgl setup failed possibly due to enabling preserveDrawingBuffer config. 
The device may not be supported by is-mobile module! 
Inverting preserveDrawingBuffer option in second attempt to create webgl scene.

On Chrome Version 84.0.4147.89 (Official Build) (64-bit), MacBook Pro (Retina, 13-inch, Mid 2014)
MacOs Catalina 10.15.5
Screen Shot 2020-07-30 at 8 38 59 PM

Also happens on firefox 78.0.2 (64-bit)

Screen Shot 2020-07-30 at 8 41 42 PM

Additional info # 1

I experimented with https://github.com/mithi/plotly-webpack
and was somewhat successful (I wasn't able to load the paper background)...
I found out that I can reproduce my plot having only a gzipped bundle size of ~410kb. This is significantly lower than when I use plotly.js-gl3d-dist-min - The latter has a gzipped bundle size of ~450kb

Screen Shot 2020-07-30 at 8 13 47 PM

Additional info # 2

Importing all the requirements here https://github.com/plotly/plotly.js/blob/master/lib/index-gl3d.js

    require('./scatter3d'),
    require('./surface'),
    require('./mesh3d'),
    require('./isosurface'),
    require('./volume'),
    require('./cone'),
    require('./streamtube')

produces the same error discussed above ... while Commenting out Plotly.register([Scatter3d]); Will remove the error and produce the following

Screen Shot 2020-07-30 at 8 21 02 PM

I also saw this issue which might be related #4989
But i don't know how to fix it in my case.

Any help is appreciated! Thanks!

@mithi
Copy link
Author

mithi commented Jul 30, 2020

SOLVED

Needed to add ify

Still isnt 100 percent okay, paper background isn't showing up.

Screen Shot 2020-07-31 at 12 19 59 AM

@mithi
Copy link
Author

mithi commented Jul 30, 2020

Background is now showing, I just needed to include mesh3d for the paper background to show

import Plotly from "plotly.js/lib/core";
import Scatter3d from "plotly.js/lib/scatter3d"
import Mesh3d from "plotly.js/lib/mesh3d"

import createPlotlyComponent from "react-plotly.js/factory";
Plotly.register([Scatter3d, Mesh3d]);

const CustomPlotly = createPlotlyComponent(Plotly);
export default CustomPlotly;

Screen Shot 2020-07-31 at 12 37 27 AM

@archmoj
Copy link
Contributor

archmoj commented Jul 30, 2020

Thanks very much @mithi for the updates.
Also please consider submitting a PR here or to https://github.com/plotly/plotly-webpack,
if you think it should be updated considering latest dependency changes.

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