-
Notifications
You must be signed in to change notification settings - Fork 6
/
axis-boundaries.stories.tsx
78 lines (75 loc) · 1.72 KB
/
axis-boundaries.stories.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import { Meta } from '@storybook/react';
import { Plot, Heading, Legend, LineSeries, Axis } from '../src';
export default {
title: 'Plot/Axis boundaries',
component: Plot,
args: {
width: 550,
height: 500,
xMin: 0,
xMax: 6,
yMin: 0,
yMax: 6,
},
} as Meta;
type Props = Record<string, number>;
export function Control(props: Props) {
const { width, height, xMin, xMax, yMax, yMin } = props;
return (
<Plot width={width} height={height}>
<Heading
title="Electrical characterization"
subtitle="current vs voltage"
/>
<LineSeries
data={[
{ x: 0, y: 0 },
{ x: 1, y: 1 },
{ x: 2, y: 2 },
{ x: 3, y: 3 },
{ x: 4, y: 3 },
{ x: 5, y: 3 },
]}
xAxis="x"
yAxis="y"
lineStyle={{ strokeWidth: 3 }}
label="Vg = 7V"
displayMarkers={false}
/>
<LineSeries
data={[
{ x: 1, y: 2 },
{ x: 2, y: 4 },
{ x: 3, y: 6 },
{ x: 4, y: 6 },
{ x: 5, y: 6 },
{ x: 6, y: 6 },
]}
xAxis="x"
yAxis="y"
displayMarkers
markerShape="circle"
label="Vg = 3V"
/>
<Axis
id="x"
position="bottom"
label="Drain voltage [V]"
displayPrimaryGridLines
min={xMin}
max={xMax}
/>
<Axis
id="y"
position="left"
label="Drain current [mA]"
displayPrimaryGridLines
min={yMin}
max={yMax}
/>
<Axis id="y" position="right" label="Drain current [mA]" />
<Axis id="x" position="top" />
<Legend position="embedded" bottom={10} right={10} />
</Plot>
);
}