Skip to content

Instantly share code, notes, and snippets.

@markmarkoh
Created February 4, 2014 18:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save markmarkoh/8809882 to your computer and use it in GitHub Desktop.
Save markmarkoh/8809882 to your computer and use it in GitHub Desktop.
Add Arcs in a timed fashion
var arcs = new Datamap({
scope: 'world',
element: document.getElementById('arcs'),
projection: 'mercator',
geographyConfig: {
highlightBorderColor: '#bada55',
popupTemplate: function(geography, data) {
if ( data )
return '<div class="hoverinfo" style="max-width: 300px;"><strong>' + geography.properties.name + '</strong> <br />' + data.desc + ' </div>'
},
highlightBorderWidth: 1
},
fills: {
'Visited': '#306596',
defaultFill: '#abdda4'
},
data:{
"ISR": {
"fillKey": "Visited",
desc: "Upon arriving in Tel Aviv, President Obama examined a battery of the \"Iron Dome\" defense system before traveling to Jerusalem for bilateral talks with Israeli President Shimon Peres and Prime Minister Benjamin Netanyahu, after which they held a joint press conference and attended a working dinner together."
},
"GBR": {
"fillKey": "Visited",
desc: "The President attended the 39th G8 summit at Lough Erne Resort in County Fermanagh, Northern Ireland."
},
"ZAF": {
"fillKey": "Visited",
desc: "On Saturday morning he was hosted for a bilateral visit by President Jacob Zuma to discuss development, peace and security issues, and the promotion of democracy in Africa, followed by a joint press conference."
},
"CRI": {
"fillKey": "Visited",
desc: "President Obama met with Central American and Dominican leaders attending the SICA summit in San José. Trade and security were the major topics of discussion."
},
"DEU": {
"fillKey": "Visited",
desc: "He met with German President Joachim Gauck at Schloss Bellevue, followed by a working lunch and joint press conference with Chancellor Angela Merkel at the Bundeskanzleramt."
},
"SEN": {
"fillKey": "Visited",
desc: "He held a bilateral meeting with President Macky Sall, after which he visited Senegal's supreme court for a meeting with regional judicial leaders."
},
"SWE": {
"fillKey": "Visited",
desc: "The trip replaces a planned bilateral visit to Moscow, which was canceled after Russia's granting of temporary asylum to Edward Snowden, the former NSA and CIA employee who revealed classified American intelligence programs utilizing extensive mass surveillance."
},
"TZA": {
"fillKey": "Visited",
desc: "The First Lady met with Tanzanian First Lady Salma Kikwete, after which she visited the memorial to victims of the 1998 embassy bombing. She then attended the performance of a local dance troupe before joining the President for a state dinner."
},
"RUS": {
"fillKey": "Visited",
desc: "G-20 summit"
},
"MEX": {
"fillKey": "Visited",
desc: "The President met with Mexican President Enrique Peña Nieto for private talks that emphasized trade, cultural and educational exchange, innovation, and research, but also touched on border security and illegal narcotics trafficking.[451]."
}
}
});
var presidentialTrips = [
{
origin: {
latitude: 38.895111,
longitude: -77.036667
},
destination: {
latitude: 32.066667,
longitude: 34.783333
}
},
{
origin: {
latitude: 38.895111,
longitude: -77.036667
},
destination: {
latitude: 19.433333,
longitude: -99.133333
}
},
{
origin: {
latitude: 38.895111,
longitude: -77.036667
},
destination: {
latitude: 9.933333,
longitude: -84.083333
}
},
{
origin: {
latitude: 38.895111,
longitude: -77.036667
},
destination: {
latitude: 54.597 ,
longitude: -5.93
}
},
{
origin: {
latitude: 38.895111,
longitude: -77.036667
},
destination: {
latitude: 52.516667,
longitude: 13.383333
}
},
{
origin: {
latitude: 38.895111,
longitude: -77.036667
},
destination: {
latitude: 14.692778,
longitude: -17.446667
}
},
{
origin: {
latitude: 38.895111,
longitude: -77.036667
},
destination: {
latitude: -26.204444,
longitude: 28.045556
}
},
{
origin: {
latitude: 38.895111,
longitude: -77.036667
},
destination: {
latitude: -6.8,
longitude: 39.283333
}
},
{
origin: {
latitude: 38.895111,
longitude: -77.036667
},
destination: {
latitude: 59.329444,
longitude: 18.068611
}
},
{
origin: {
latitude: 38.895111,
longitude: -77.036667
},
destination: {
latitude: 59.95 ,
longitude: 30.3
}
}
];
function addArcs(index) {
arcs.arc( presidentialTrips.slice(0, index) , {strokeWidth: 2});
if ( index < presidentialTrips.length ) {
window.setTimeout(function() {
addArcs(++index)
}, 750);
}
}
addArcs(1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment