mirror of
https://github.com/aljazceru/twentyone-world.github.io.git
synced 2025-12-19 06:14:24 +01:00
82 lines
2.3 KiB
HTML
82 lines
2.3 KiB
HTML
---
|
|
layout: showcase
|
|
title: Twentyone World
|
|
jsplugins:
|
|
qtip: '/js/jquery.qtip.min.js'
|
|
---
|
|
|
|
<link rel="stylesheet" type="text/css" href="/css/jquery.qtip.css">
|
|
<script type="text/javascript" src="/js/jquery.qtip.min.js"></script>
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
$(function() {
|
|
|
|
// initialize tooltips
|
|
$.fn.qtip.defaults.style.classes = 'ui-tooltip-bootstrap';
|
|
$.fn.qtip.defaults.style.def = false;
|
|
|
|
var map = kartograph.map('#map');
|
|
|
|
map.loadMap('map/world.svg', function() {
|
|
map.addLayer('context', {
|
|
styles: {
|
|
stroke: '#aaa',
|
|
fill: '#f6f4f2'
|
|
}
|
|
});
|
|
map.addLayer('countries', {
|
|
id: 'bg',
|
|
styles: {
|
|
stroke: '#d8d6d4',
|
|
'stroke-width': 6.15,
|
|
'stroke-linejoin': 'round'
|
|
}
|
|
});
|
|
|
|
map.addLayer('countries', {
|
|
title: function(d) { return d.name },
|
|
styles: {
|
|
stroke: '#333',
|
|
fill: '#fff'
|
|
}
|
|
});
|
|
|
|
$.ajax({
|
|
url: 'data/countries.json',
|
|
dataType: 'json',
|
|
success: function(cities) {
|
|
|
|
var scale = kartograph.scale.sqrt(cities.concat([{ nb_visits: 0 }]), 'nb_visits').range([0, 60]);
|
|
|
|
map.addSymbols({
|
|
type: kartograph.Bubble,
|
|
data: cities,
|
|
location: function(city) {
|
|
return [city.long, city.lat];
|
|
},
|
|
radius: function(city) {
|
|
return scale(city.nb_visits);
|
|
},
|
|
tooltip: function(city) {
|
|
return '<h3>'+city.city_name+'</h3>'+city.nb_visits+' visits';
|
|
},
|
|
sortBy: 'radius desc',
|
|
style: 'fill:#800; stroke: #fff; fill-opacity: 0.5;',
|
|
});
|
|
}
|
|
});
|
|
|
|
}, { padding: -5 });
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
<div id="map" style="border:0px solid #999; margin-bottom:1em">
|
|
</div>
|
|
|
|
<p>Lorem ipsum, add your stuff.</p>
|