-
Notifications
You must be signed in to change notification settings - Fork 1
/
d3-graph.js
129 lines (124 loc) · 3.19 KB
/
d3-graph.js
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
import React, { Component } from 'react';
import Svg,{
Circle,
Ellipse,
G,
LinearGradient,
RadialGradient,
Line,
Path,
Text,
Polygon,
Polyline,
Rect,
Symbol,
Use,
Defs,
Stop
} from 'react-native-svg';
class D3Graph extends Component {
render() {
var xAxisXOffset = 45;
var xAxisYOffset = 13;
var yAxisYOffset = 14;
return(
<Svg
width="300"
height="135"
>
<G
x="25"
y="8"
>
<Path
class="Line"
d="M530,190.81307074485642L515.2777777777777,192.18285840026405L456.3888888888889,180.3927824843217L441.6666666666667,177.3231378589504L426.94444444444446,166.99856969963693L412.22222222222223,154.97744526350533L147.22222222222223,0.8416767521179624L132.5,3.934426229508224L117.77777777777777,2.2807789635823426L29.444444444444443,6.142589943888224L14.722222222222221,7.179007591594232L0,9.654527450764668"
stroke={this.props.lineColor}
strokeWidth={2}
fill="none"
/>
<G
y="100"
>
<G
x={xAxisXOffset}
y={xAxisYOffset}
>
<Text dy=".71em" y="9" x="0">April</Text>
</G>
<G
x={xAxisXOffset * 2}
y={xAxisYOffset}
>
<Text dy=".71em" y="9" x="0">Apr 08</Text>
</G>
<G
x={xAxisXOffset * 3}
y={xAxisYOffset}
>
<Text dy=".71em" y="9" x="0">Apr 15</Text>
</G>
<G
x={xAxisXOffset * 4}
y={xAxisYOffset}
>
<Text dy=".71em" y="9" x="0">Apr 22</Text>
</G>
<G
x={xAxisXOffset * 5}
y={xAxisYOffset}
>
<Text dy=".71em" y="9" x="0">Apr 29</Text>
</G>
<Path class="domain" d="M0,6V0H530V6"></Path>
</G>
<G
class="y axis"
>
<G
y={yAxisYOffset * 7}
>
<Text dy=".32em" x="-9" y="0">0</Text>
</G>
<G
y={yAxisYOffset * 6}
>
<Text dy=".32em" x="-9" y="0">100</Text>
</G>
<G
y={yAxisYOffset * 5}
>
<Text dy=".32em" x="-9" y="0">200</Text>
</G>
<G
y={yAxisYOffset * 4}
>
<Text dy=".32em" x="-9" y="0">300</Text>
</G>
<G
y={yAxisYOffset * 3}
>
<Text dy=".32em" x="-9" y="0">400</Text>
</G>
<G
y={yAxisYOffset * 2}
>
<Text dy=".32em" x="-9" y="0">500</Text>
</G>
<G
y={yAxisYOffset * 1}
>
<Text dy=".32em" x="-9" y="0">600</Text>
</G>
<Path
class="domain"
d="M-6,0H0V106H-6"
y="-104"
/>
</G>
</G>
</Svg>
)
}
}
export default D3Graph