-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex_second_version.html
49 lines (43 loc) · 1.25 KB
/
index_second_version.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="http://d3js.org/d3.v3.min.js"></script>
<script src="http://dimplejs.org/dist/dimple.v2.0.0.min.js"></script>
<script type="text/javascript">
function draw(data) {
/*
D3.js setup code
*/
"use strict";
var margin = 85,
width = 900 - margin,
height = 400 - margin;
var svg = d3.select("body")
.append("svg")
.attr("width", width + margin)
.attr("height", height + margin)
.append('g')
.attr('class','chart');
/*
Dimple.js Chart construction code
*/
var myChart = new dimple.chart(svg, data);
var x = myChart.addCategoryAxis("x", ["Pclass", "Survived"]);
myChart.addMeasureAxis("y", "PassengerId");
myChart.addSeries("Survived", dimple.plot.bar);
myChart.addLegend(65, 10, 510, 20, "right");
myChart.draw();
};
</script>
</head>
<body>
<script type="text/javascript">
/*
Use D3 (not dimple.js) to load the TSV file
and pass the contents of it to the draw function
*/
d3.csv("titanic-data.csv", draw);
</script>
</body>
</html>