Skip to content

Commit

Permalink
added annotations to world map
Browse files Browse the repository at this point in the history
  • Loading branch information
ronniedada committed Jun 13, 2013
1 parent 156abd7 commit d051997
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
2 changes: 2 additions & 0 deletions static/app.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<meta name="viewport" content="width=device-width">

<link rel="stylesheet" href="/static/css/bootstrap.min.css">
<link rel="stylesheet" href="/static/css/tipsy.css">
<style>
body {
padding-top: 60px;
Expand Down Expand Up @@ -57,6 +58,7 @@
<script src="/static/lib/angular/angular.js"></script>
<script src="/static/lib/d3.v3.min.js"></script>
<script src="/static/lib/topojson.v0.min.js"></script>
<script src="/static/lib/jquery.tipsy.js"></script>
<script src="/static/js/cbs.js"></script>
<script src="/static/js/controllers.js"></script>
<script src="/static/js/directives.js"></script>
Expand Down
25 changes: 25 additions & 0 deletions static/css/tipsy.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
.tipsy { font-size: 10px; position: absolute; padding: 5px; z-index: 100000; }
.tipsy-inner { background-color: #000; color: #FFF; max-width: 200px; padding: 5px 8px 4px 8px; text-align: center; }

/* Rounded corners */
.tipsy-inner { border-radius: 3px; -moz-border-radius: 3px; -webkit-border-radius: 3px; }

/* Uncomment for shadow */
/*.tipsy-inner { box-shadow: 0 0 5px #000000; -webkit-box-shadow: 0 0 5px #000000; -moz-box-shadow: 0 0 5px #000000; }*/

.tipsy-arrow { position: absolute; width: 0; height: 0; line-height: 0; border: 5px dashed #000; }

/* Rules to colour arrows */
.tipsy-arrow-n { border-bottom-color: #000; }
.tipsy-arrow-s { border-top-color: #000; }
.tipsy-arrow-e { border-left-color: #000; }
.tipsy-arrow-w { border-right-color: #000; }

.tipsy-n .tipsy-arrow { top: 0px; left: 50%; margin-left: -5px; border-bottom-style: solid; border-top: none; border-left-color: transparent; border-right-color: transparent; }
.tipsy-nw .tipsy-arrow { top: 0; left: 10px; border-bottom-style: solid; border-top: none; border-left-color: transparent; border-right-color: transparent;}
.tipsy-ne .tipsy-arrow { top: 0; right: 10px; border-bottom-style: solid; border-top: none; border-left-color: transparent; border-right-color: transparent;}
.tipsy-s .tipsy-arrow { bottom: 0; left: 50%; margin-left: -5px; border-top-style: solid; border-bottom: none; border-left-color: transparent; border-right-color: transparent; }
.tipsy-sw .tipsy-arrow { bottom: 0; left: 10px; border-top-style: solid; border-bottom: none; border-left-color: transparent; border-right-color: transparent; }
.tipsy-se .tipsy-arrow { bottom: 0; right: 10px; border-top-style: solid; border-bottom: none; border-left-color: transparent; border-right-color: transparent; }
.tipsy-e .tipsy-arrow { right: 0; top: 50%; margin-top: -5px; border-left-style: solid; border-right: none; border-top-color: transparent; border-bottom-color: transparent; }
.tipsy-w .tipsy-arrow { left: 0; top: 50%; margin-top: -5px; border-right-style: sol
9 changes: 9 additions & 0 deletions static/js/directives.js
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,15 @@ function worldMap(data, scope, args) {
return scope.color(d.os);
});

$('svg circle').tipsy({
gravity: 's',
title: function() {
var d = this.__data__;
return 'country: ' + d.country
+ ', os: ' + d.os
+ ', size: ' + d.size;
}
});
// zoom in on click
function click(d) {
var x, y, k;
Expand Down

0 comments on commit d051997

Please sign in to comment.