-
Notifications
You must be signed in to change notification settings - Fork 941
/
refresh.html
50 lines (39 loc) · 971 Bytes
/
refresh.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>
<head>
<link type="text/css" rel="stylesheet" href="../rickshaw.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script>
<script src="../vendor/d3.v3.js"></script>
<script src="../rickshaw.js"></script>
</head>
<body>
<div id="chart_container">
<div id="chart"></div>
<button id="refresh">refresh</button>
</div>
<script>
var dataURLs = ['data/data.json', 'data/data2.json'];
var ajaxGraph = new Rickshaw.Graph.Ajax( {
element: document.getElementById("chart"),
width: 400,
height: 200,
renderer: 'line',
dataURL: 'data/data.json',
series: [
{
name: 'New York',
color: '#c05020',
}, {
name: 'London',
color: '#30c020',
}, {
name: 'Tokyo',
color: '#6060c0'
}
]
} );
document.querySelector('#refresh').addEventListener('click', function() {
ajaxGraph.dataURL = ajaxGraph.dataURL === dataURLs[0] ? dataURLs[1] : dataURLs[0];
ajaxGraph.request();
});
</script>
</body>