Skip to content

Commit af26ce8

Browse files
author
Joe Hanley
committed
Initial d3 barchart
1 parent 8efd108 commit af26ce8

File tree

5 files changed

+56
-8
lines changed

5 files changed

+56
-8
lines changed

bootstrapTest.css

+12-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,16 @@ body{
1313
text-align:center;
1414
border-radius:3px;
1515
}
16-
16+
#beenHereBefore{
17+
position:absolute;
18+
top:10px;
19+
right:15px;
20+
background-color:#EEEEEE;
21+
border: 1px solid #CCCCCC;
22+
padding: 10px;
23+
24+
25+
}
1726
#logo{
1827
position:relative;
1928
width:100px;
@@ -83,6 +92,7 @@ body{
8392

8493
}
8594
#helpText{
86-
color:
95+
position:relative;
96+
top:30px;
8797

8898
}

bootstrapTest.html

+9-6
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,29 @@
66
</head>
77

88
<body>
9-
<div class = 'container'>
9+
<div id='beenHereBefore'>
10+
<a href=http://google.com>Been here before?</a>
11+
</div>
12+
<div class = 'container-fluid'>
1013

1114
<div class = 'row-fluid'>
1215

13-
<div id = 'mainbox' class = 'span8 offset2'>
16+
<div id = 'mainbox' class = 'span8 offset3'>
1417
<div id = 'contentBox' class=''>
1518
<img id = 'logo' src="http://beathound.com/bh-icon.png" >
1619
<h2 id='logoText'><span id='beat'>Beat</span><span id='hound'>hound</span></h2>
1720
<h2 id='splashText'>New releases from the artists you love,straight to your inbox every week.</h2>
1821
<span id='uploadNowText'>Upload your iTunes library XML file to find out what you've been missing.</span>
19-
<form id='form'>
22+
<form id='form' class="row-fluid">
2023
<div id='getFile'>Upload your file
2124
<button>Choose file</button>
2225
No file chosen
2326
</div>
2427
<input id='emailInput' type="text" placeholder="email my results to...">
25-
<div><button id='analyze'>
26-
<span style="color:#FFFFFF"> Analyze</span></button>
28+
<div><button id='analyze' class = 'btn btn-success'>
29+
Analyze</button>
2730
</div>
28-
<span id='helpText'>Need help?</span>
31+
<a id = 'helpText' href=http://google.com>Need help?</a>
2932

3033
</form>
3134
</div>

day8/visual.css

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.chart div {
2+
background-color:#aac8dd;
3+
color:#fff;
4+
border: 1px solid #99b8cc;
5+
6+
}

day8/visual.html

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<html>
2+
<head>
3+
<title>Visualizations</title>
4+
<script src='https://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.js'></script>
5+
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
6+
<link href='visual.css' rel = 'stylesheet'>
7+
</head>
8+
<body>
9+
<div class='chart-container'>
10+
<script src='visual.js'></script>
11+
12+
</div>
13+
14+
15+
</body>
16+
17+
18+
19+
</html>

day8/visual.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
var dataList = [0,4,8,8,15,16,23,42];
2+
3+
var x_scale = d3.scale.linear()
4+
.domain([0,d3.max(dataList)]).range(['0%', '100%']);
5+
6+
var chart = d3.select(".chart-container").append("div").attr("class","chart");
7+
8+
chart.selectAll("div").data(dataList).enter().append("div")
9+
.style("width", x_scale)
10+
.text(function(d) {return d});

0 commit comments

Comments
 (0)