Demo of a bug that happens when you trigger updateChoropleth
from a geography click. Fill is updated properly, but per the mouseout functions found at https://github.com/markmarkoh/datamaps/blob/master/src/js/datamaps.js#L523 & https://github.com/markmarkoh/datamaps/blob/master/src/js/datamaps.js#L252, when you mouseout from the just-selected geography, the fill reverts.
A Pen by Alan David Garcia on CodePen.
##External Properties
Please see this visual editor that is available for editing properties of a topojson file.
Please refer to the external properties section of the Command Line Reference for the topojson tool to learn about how to merge properites from an external CSV file into an existing topojson file.
##Merging a region property for each country in Asia and Africa The output topojson should contain a modified properties object for each country in Asia or Africa. For example:
function JSONToCSVConvertor(JSONData, ReportTitle, ShowLabel) { | |
//If JSONData is not an object then JSON.parse will parse the JSON string in an Object | |
var arrData = typeof JSONData != 'object' ? JSON.parse(JSONData) : JSONData; | |
var CSV = ''; | |
//Set Report title in first row or line | |
CSV += ReportTitle + '\r\n\n'; | |
//This condition will generate the Label/Header |
<?xml version="1.0" encoding="UTF-8"?> | |
<gpx creator="StravaGPX" version="1.1" xmlns="http://www.topografix.com/GPX/1/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd"> | |
<trk> | |
<name>Tour de France - Etape 20... MAGIQUE!</name> | |
<trkseg> | |
<trkpt lat="45.2027360" lon="6.6691160"> | |
<ele>0.0</ele> | |
</trkpt> | |
<trkpt lat="45.2027360" lon="6.6691160"> | |
<ele>1061.0</ele> |
Playing with reusing d3.geo for plotting. Subsequent example: http://bl.ocks.org/monfera/11085004
Mike Bostock and Jason Davies have added cool geo features, some of which can be of interest for regular data plotting too (most of which not covered in this example):
- The use of projections to easily change between Cartesian, polar, spiral, etc. plots
- d3.geo supports spherical projections; this example projects a sphere-bound spiral
- Traditional, but data-intensive plots can benefit from adaptive resampling and line simplification
module.exports.register = function (Handlebars, options) { | |
Handlebars.registerHelper('concat', function() { | |
var outStr = ''; | |
for(var arg in arguments){ | |
if(typeof arguments[arg]!='object'){ | |
outStr += arguments[arg]; | |
} | |
} | |
return outStr; |
Rank | Rider | Team | Time Seconds | Time Label | |
---|---|---|---|---|---|
1 | Rohan Dennis (AUS) | BMC Racing Team | 0 | 14' 56" | |
2 | Tony Martin (GER) | Etixx–Quick-Step | 5 | + 5" | |
3 | Fabian Cancellara (SUI) | Trek Factory Racing | 6 | + 6" | |
4 | Tom Dumoulin (NED) | Giant–Alpecin | 8 | + 8" | |
5 | Jos Van Emden (NED) | LottoNL–Jumbo | 15 | + 15" | |
6 | Jonathan Castroviejo (ESP) | Movistar Team | 23 | + 23" | |
7 | Matthias Brandle (AUT) | IAM Cycling | 23 | + 23" | |
8 | Adriano Malori (ITA) | Movistar Team | 29 | + 29" | |
9 | Wilco Kelderman (NED) | LottoNL–Jumbo | 30 | + 30" |
Smooth transitioning US tour in the same vein as this example. Steps:
- Compares both shapes and adds evenly-spaced points to whichever polygon has fewer so that both have the same number of points
- Picks the winding of the first polygon that minimizes the sum of the squared distances between point pairs
Some possible improvements:
- Adding additional points to both shapes first such that every segment longer than a certain distance is bisected
- Tweaking the placement of added points with simulated annealing
- Using a cost function that factors in self-intersections at the halfway mark in addition to distance traveled
var express = require('express') | |
var rp = require('request-promise') | |
var bodyParser = require("body-parser"); | |
var app = express() | |
app.use(bodyParser.urlencoded({extended: true})); | |
app.use(bodyParser.json()); |