Graphics Reference
In-Depth Information
var row;
var country;
var countryMap= {};
var countries= [];
// build a map of all countries by code
for (i=0; i<allCountries.length; i++) {
row = allCountries[i];
countryMap[row.ISONo] = row;
}
// then form a list of only those countries in the
data
for (i=0; i<imports.length; i++) {
row = imports[i];
// (data is grouped by reporter so watch for a
change)
if (country !== row.Reporter) {
country = row.Reporter;
countries.push(countryMap[row.Reporter]);
}
}
return countries;
}
Tip
Everything in a visualization communicates information. Think of ways
to order data in structured layouts like lists and circles that are
consistent with a reader's expectations and enhance the clarity of
communication.
Next, create a function to sort the countries by angle of direction from 40
degrees latitude and -40 degrees longitude, which is roughly in the middle
of the Atlantic Ocean. Here, the country records are enhanced in place with
an extra directional member property for sorting:
Search WWH ::




Custom Search