-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.html
More file actions
71 lines (55 loc) · 1.55 KB
/
example.html
File metadata and controls
71 lines (55 loc) · 1.55 KB
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
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.6/d3.min.js"></script>
<script type="text/javascript" src="src/range-slider.js"></script>
<style>
body {
background: rgba(0,0,0,.2);
}
#container {
margin: 0 auto;
padding-top: 100px;
width: 25%;
text-align: left;
}
#hourSlider {
width: 100%;
height: 40px;
}
.axis path,
.axis line {
fill: none;
stroke: black;
shape-rendering: crispEdges;
}
.axis text {
font-family: sans-serif;
font-size: 11px;
}
</style>
<script type="text/javascript">
$(function(){
var slider = d3.svg.rangeSlider();
slider.on("change", function(event, params){
console.log(event);
console.log(slider.values());
})
.on("slide", function(event, params){
console.log(event);
console.log(slider.values());
})
var svg = d3.select("svg");
svg.append("g")
.call(slider);
});
</script>
</head>
<body>
<div id="container">
Drag the left and right handles. You can drag the whole slider by dragging the space between the rectangles.<br/><br/>
<svg id="hourSlider"></svg>
</div>
</body>
</html>