-
Notifications
You must be signed in to change notification settings - Fork 941
/
resize.html
50 lines (40 loc) · 994 Bytes
/
resize.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
<!doctype html>
<link type="text/css" rel="stylesheet" href="../src/css/graph.css">
<link type="text/css" rel="stylesheet" href="css/lines.css">
<script src="../node_modules/d3/d3.min.js"></script>
<script src="../rickshaw.js"></script>
<div id="chart"></div>
<div id="preview"></div>
<script>
var seriesData = [ [], [] ];
var random = new Rickshaw.Fixtures.RandomData(150);
for (var i = 0; i < 150; i++) {
random.addData(seriesData);
}
var graph = new Rickshaw.Graph( {
element: document.getElementById("chart"),
renderer: 'area',
series: [
{
data: seriesData[0],
color: 'steelblue'
}, {
data: seriesData[1],
color: 'lightblue'
}
]
} );
var resize = function() {
graph.configure({
width: window.innerWidth * 0.75,
height: window.innerHeight * 0.75
});
graph.render();
}
var preview = new Rickshaw.Graph.RangeSlider.Preview({
graph: graph,
element: document.getElementById('preview')
});
window.addEventListener('resize', resize);
resize();
</script>