Git Product home page Git Product logo

Comments (9)

nicolaskruchten avatar nicolaskruchten commented on May 23, 2024

Thanks for this bug report! I can't actually replicate this behaviour outside of your repo, for example this works for me:

<!DOCTYPE html>
<html>
    <head>
        <title>react-plotly.js Scratch</title>
        <script crossorigin src="https://unpkg.com/react@16/umd/react.development.js"></script>
        <script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
        <script crossorigin src="https://cdn.plot.ly/plotly-1.33.0.min.js"></script>
        <script crossorigin src="https://unpkg.com/[email protected]/dist/create-plotly-component.js"></script>
    </head>
    <body>
        <div id="chart"> </div>
    <script>
        var gd = document.getElementById('chart')
        var data = [
            {
              x: [1, 2, 3],
              y: [4, 5, 6],
              z: [7, 8, 9],
              type: 'scatter3d',
              mode: 'lines+markers',
            }
          ];
        var layout = {};

        ReactDOM.render(
          React.createElement(createPlotlyComponent(Plotly),
            { data: data, layout: layout}), gd );

    </script>
    </body>
</html>

from react-plotly.js.

lnunno avatar lnunno commented on May 23, 2024

Any idea what might be causing this? My guess might be something with how the webpack integration might be working, although I've followed the instructions for that in the README. I'm seeing this consistently with this webpack setup.

I also experimented by using a ref directly and using the Plotly library and not React-Plotly but seeing the same behavior. I was also having some trouble getting the imports to work as specified as in here. Was seeing runtime errors from react when using the default import e.g.

import Plot from 'react-plotly.js'; // Error

and

import { Plot } from 'react-plotly.js'; // Error

Don't know if this is related, I see you using createReactPlotlyComponent, but I'm assuming that's integrated into how the module is exported.

from react-plotly.js.

nicolaskruchten avatar nicolaskruchten commented on May 23, 2024

OK, first things first: I was able to reproduce the axes issue with Webpack and without React or create-react-app or TypeScript, so the issue seems to be in the Webpack bundling step. I'll try to find a fix for this shortly, but I may need to involve some plotly.js people.

With respect to the imports import Plot from 'react-plotly.js' definitely works for multiple projects on this end, so let's create a new issue for that please, so as to stick to one problem/one Github issue :)

from react-plotly.js.

nicolaskruchten avatar nicolaskruchten commented on May 23, 2024

I believe we have a fix ready for this problem, it seems to be a dependency issue that shows up differently based on whether you install with yarn or npm :(

from react-plotly.js.

lnunno avatar lnunno commented on May 23, 2024

@nicolaskruchten Awesome, looking forward to the fix.

from react-plotly.js.

nicolaskruchten avatar nicolaskruchten commented on May 23, 2024

This should be fixed with the latest version of plotly.js. There were some issues with versions of gl-shader that were installing in a different order depending on whether you were using Yarn or NPM but the new version should be more deterministic/correct.

from react-plotly.js.

nicolaskruchten avatar nicolaskruchten commented on May 23, 2024

I've just tried your example app with plotly.js version 1.34.0 and it works with both NPM and Yarn but please note that I had to erase yarn.lock and rebuild it in order to make it work, otherwise it still installed the wrong version of gl-shader for some dependencies for some reason that I'm struggling to understand.

from react-plotly.js.

nicolaskruchten avatar nicolaskruchten commented on May 23, 2024

(note that I'm assuming the error was from gl-shader based on some previous investigations but it might be something else too)

from react-plotly.js.

lnunno avatar lnunno commented on May 23, 2024

Thanks, I've confirmed this works 👍

from react-plotly.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.