Skip to content

Graphs do not render in PopOS React App #353

Open
@Frick-David

Description

@Frick-David

I am making a React app using Plotly connected to a flask backend. However, my graphs only display as white squares that when hovered over display the plotly toolbar.

This is a picture of what it looks like: here

When I use the command npm start, I get this message which might have something to do with it:

WARNING in ./node_modules/plotly.js/dist/plotly.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/david/Programming/Python-Projects/Investment-Hunter-Web/frontend/node_modules/plotly.js/dist/maplibre-gl-unminified.js.map' file: Error: ENOENT: no such file or directory, open '/home/david/Programming/Python-Projects/Investment-Hunter-Web/frontend/node_modules/plotly.js/dist/maplibre-gl-unminified.js.map'

Can anyone help me figure out why my plotly graphs are not displaying at all?

My code seems relatively straightforward as I hard coded the numbers to begin with just to get something going:

import React from 'react';
import Plot from 'react-plotly.js'

function Portfolio() {
    const growthPortfolio = [{
            values: [19, 26, 55],
            labels: ['Residential', 'Non-Residential', 'Utility'],
            type: 'pie',
            hole: 0.4,
    }]

    const valuePortfolio = [{
            values: [30, 40, 30],
            labels: ['Residential', 'Non-Residential', 'Utility'],
            type: 'pie',
            hole: 0.4,
    }]


    const totalPortfolio = [{
            values: [45, 35, 20],
            labels: ['Residential', 'Non-Residential', 'Utility'],
            type: 'pie',
            hole: 0.4,
    }]


    return (
        <div>
            <Plot data={growthPortfolio} />
            <Plot data={valuePortfolio} />
            <Plot data={totalPortfolio}/>
        </div>
    );
}

export default Portfolio;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions