File: socket.io.html

package info (click to toggle)
rickshaw 1.5.1.dfsg-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,864 kB
  • sloc: javascript: 15,281; makefile: 97; perl: 59
file content (44 lines) | stat: -rw-r--r-- 1,082 bytes parent folder | download | duplicates (5)
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
<!doctype html>
<head>
	<link type="text/css" rel="stylesheet" href="../src/css/graph.css">
	<link type="text/css" rel="stylesheet" href="../examples/css/lines.css">

	<script src="../vendor/d3.v2.js"></script>

	<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script>
  <script src="/socket.io/socket.io.js"></script>

	<script src="../rickshaw.js"></script>
</head>
<body>

<div id="chart_container">
	<div id="chart"></div>
</div>

<script>

Rickshaw.Graph.Socketio.Static = Rickshaw.Class.create( Rickshaw.Graph.Socketio, {
	request: function() {
	  var socket = io.connect(this.dataURL);
	  thisData = this;
    socket.on('rickshaw', function (data) {
      console.log("Got some fancy Websocket data: ");
      console.log(data);
      thisData.success(data);
    });
	}
} );

var socketioGraph = new Rickshaw.Graph.Socketio.Static( {
	element: document.getElementById("chart"),
	width: 400,
	height: 200,
	renderer: 'line',
	dataURL: "http://localhost",
	onData: function(d) { Rickshaw.Series.zeroFill(d); return d }
} );

</script>

</body>