xxxxxxxxxx
<html>
<head>
<script src='https://api.tiles.mapbox.com/mapbox.js/v0.6.6/mapbox.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox.js/v0.6.6/mapbox.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
#map { position:absolute; top:0; bottom:0; width:100%; }
</style>
</head>
<body>
<style>
.marker-image {
width:100px;
height:100px;
border:1px solid #000;
margin-left:-51px;
margin-top:-51px;
pointer-events:all;
position:absolute;
}
</style>
<div id='map'></div>
<script>
// Create map
var map = mapbox.map('map');
map.addLayer(mapbox.layer().id('examples.map-vyofok3q'));
// Create and add marker layer
var markerLayer = mapbox.markers.layer().features([{
"geometry": { "type": "Point", "coordinates": [-74.00, 40]},
"properties": { "image": "https://placehold.it/100x100" }
}, {
"geometry": { "type": "Point", "coordinates": [-75.00, 40]},
"properties": { "image": "https://www.dummyimage.com/100x100/bd00bd/fff" }
}]).factory(function(f) {
// Define a new factory function. This takes a GeoJSON object
// as its input and returns an element - in this case an image -
// that represents the point.
var img = document.createElement('img');
img.className = 'marker-image';
img.setAttribute('src', f.properties.image);
return img;
});
map.addLayer(markerLayer)
.setExtent(markerLayer.extent());
// Attribute map
map.ui.attribution.add()
.content('<a href="https://mapbox.com/about/maps">Terms & Feedback</a>');
</script>
</body>
</html>
<meta charset="utf-8">
<style>
body {
font: 10px sans-serif;
}
.axis path,
.axis line {
fill: none;
stroke: #000;
shape-rendering: crispEdges;
}
.area {
fill: steelblue;
}
</style>
<body>
<script src="https://d3js.org/d3.v3.js"></script>
<a href="#" id="download">Download</a>
<script>
var data = [[1315612801000,461697],[1316476801000,461697],[1318204801000,476686],[1319068801000,481637],[1320883201000,492107],[1321747201000,496361],[1322611201000,501465],[1323475201000,506092],[1324339201000,510330],[1325289601000,515315],[1326153601000,520827],[1327017601000,527556],[1327968001000,533378],[1328832001000,538625],[1329696001000,543344],[1330473601000,547271],[1331337601000,557571],[1332201601000,567630],[1333152001000,576848],[1334016001000,587274],[1334880001000,595450],[1335744001000,602346],[1336608001000,609139],[1337472001000,615408],[1338422401000,622467],[1339286401000,629148],[1340150401000,637007],[1341014401000,643300],[1341878401000,651671],[1342742401000,671211],[1343692801000,691111],[1344556801000,710146],[1345420801000,730822],[1346371201000,755425],[1347235201000,775710],[1348099201000,799366],[1348963201000,825278],[1349827201000,848599],[1350691201000,868337],[1351641601000,886566],[1352505601000,904752]];
data = data.map(function(d) {
return {
date: new Date(d[0]),
users: d[1]
};
});
var margin = {top: 20, right: 20, bottom: 30, left: 50},
width = 400 - margin.left - margin.right,
height = 200 - margin.top - margin.bottom;
var x = d3.time.scale()
.range([0, width]);
var y = d3.scale.linear()
.range([height, 0]);
var xAxis = d3.svg.axis()
.scale(x)
.orient("bottom")
.ticks(5);
var yAxis = d3.svg.axis()
.scale(y)
.orient("left")
.ticks(5);
var area = d3.svg.area()
.x(function(d) { return x(d.date); })
.y0(height)
.y1(function(d) { return y(d.users); });
var svg = d3.select("body").append("svg")
.attr("width", width + margin.left + margin.right)
.attr("height", height + margin.top + margin.bottom)
.append("g")
.attr("transform", "translate(" + margin.left + "," + margin.top + ")");
x.domain(d3.extent(data, function(d) { return d.date; }));
y.domain(d3.extent(data, function(d) { return d.users; }));
svg.append("path")
.datum(data)
.attr("class", "area")
.attr("d", area);
svg.append("g")
.attr("class", "x axis")
.attr("transform", "translate(0," + height + ")")
.call(xAxis);
svg.append("g")
.attr("class", "y axis")
.call(yAxis)
.append("text")
.attr("transform", "rotate(-90)")
.attr("y", 6)
.attr("dy", ".71em")
.style("text-anchor", "end")
.text("Users");
d3.select("#download")
.on("mouseover", function(){
var html = d3.select("svg")
.attr("version", 1.1)
.attr("xmlns", "https://www.w3.org/2000/svg")
.node().parentNode.innerHTML;
d3.select(this)
.attr("href-lang", "image/svg+xml")
.attr("href", "data:image/svg+xml;base64,\n" + btoa(html));
});
</script>
Modified http://api.tiles.mapbox.com/mapbox.js/v0.6.6/mapbox.js to a secure url
Modified http://d3js.org/d3.v3.js to a secure url
https://api.tiles.mapbox.com/mapbox.js/v0.6.6/mapbox.js
https://d3js.org/d3.v3.js