In my React Web App, I would like to use "react-plotly.js" library to render a Plotly plot from the JSON file exported from Python.
An example of the JSON file is:
{
"data": [{
"values": [19, 26, 55],
"labels": ["Residential", "Non-Residential", "Utility"],
"type": "pie"
}],
"layout": {
"height": 400,
"width": 500,
"title": "Pie chart"
}
}
The code snippet for rendering the plot component is:
import Plot from 'react-plotly.js';
... ... ... ...
<div style={{ width: "100%" }}>
<Plot
data={plotData.data}
layout={{
...plotData.layout
}}
config={{ responsive: true }}
useResizeHandler={true}
style={{ width: "100%", height: "100%" }}
/>
</div>
When I ran the React web app, the title of the plot was not rendered.
I am with "react-plotly.js": "^2.6.0".
Please help.
