-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathexample-hydrograph.html
58 lines (49 loc) · 1.57 KB
/
example-hydrograph.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Example Graph</title>
<script src="https://mroberge.github.io/HydroCloud/lib/d3/d3.min.js"></script>
<script src="https://mroberge.github.io/HydroCloud/src/graph-scatterChart.js"></script>
<style>
/*These are for styling the graph.*/
svg {
font: 10px sans-serif;
}
.Title {
font: 20px serif;
}
path {
fill: none;
stroke-width: 2px;
}
.axis path, .axis line {
fill: none;
stroke: #000;
shape-rendering: crispEdges;
}
</style>
</head>
<body>
<div id="graph_div"></div>
<script>
var graphDiv = d3.select("#graph_div");
var myChart = scatterChart();
//each timeseries is an array of elements.
//each element is an array with a Date object and a value.
//each dataset is an array of timeseries.
var timeseries1 = [ [new Date(2017, 1, 1),5],
[new Date(2017, 1, 2),9],
[new Date(2017, 1, 3),3],
[new Date(2017, 1, 4),5],
[new Date(2017, 1, 5),5] ];
var timeseries2 = [ [new Date(2017, 1, 1),12],
[new Date(2017, 1, 2),23],
[new Date(2017, 1, 3),7],
[new Date(2017, 1, 4),11],
[new Date(2017, 1, 5),15] ];
myData = [timeseries1, timeseries2];
graphDiv.datum(myData).call(myChart);
</script>
</body>
</html>