-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathChart.jsx
More file actions
22 lines (21 loc) · 813 Bytes
/
Chart.jsx
File metadata and controls
22 lines (21 loc) · 813 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import Plot from 'react-plotly.js'
export default function Chart({ title, series }) {
return (
<Plot
data={series.map(s => ({ x: s.x, y: s.y, type: s.type || 'scatter', name: s.name }))}
layout={{
title: { text: title, font: { size: 16, color: 'var(--text)' } },
autosize: true,
margin: { t: 40, r: 10, b: 40, l: 40 },
paper_bgcolor: 'transparent',
plot_bgcolor: 'transparent',
font: { color: 'var(--text)' },
xaxis: { gridcolor: 'var(--border)', zerolinecolor: 'var(--border)' },
yaxis: { gridcolor: 'var(--border)', zerolinecolor: 'var(--border)' }
}}
style={{ width: '100%', height: '360px' }}
useResizeHandler
config={{ displayModeBar: false }}
/>
)
}