I have the following 3D scene created using react-three/fiber
: full code on gist, basically rendering the <Canvas>
component in root.render()
, in which <Episode />
defines the 3D scene.
root.render(
<Canvas>
<Episode />
</Canvas>
);
But I don’t know how to put a react-plotly-js chart/component on top of it, using the example code shown on react plotly.js in javascript.
I can replace the Canvas
component in root.render()
with the example plot
component shown on react plotly.js
webpage:
root.render(
<Plot
data={[
{
x: [1, 2, 3],
y: [2, 6, 3],
type: 'scatter',
mode: 'lines+markers',
marker: { color: 'red' },
},
{ type: 'bar', x: [1, 2, 3], y: [2, 5, 3] },
]}
layout={{
width: 800,
height: 600,
title: 'A Fancy Plot',
paper_bgcolor: 'rgba(0,0,0,0)',
plot_bgcolor: 'rgba(0,0,0,0)',
}}
/>
)
… and I can get the bar chart rendered in the root
div:
But I don’t know how to overlay this transparent chart on top of the 3D scene created by react-three/fiber
, i.e. adding the plot
component on top of the <Canvas>
component within root.render()
.
Appreciate your kind help.