forio / contour-geo Goto Github PK
View Code? Open in Web Editor NEWLicense: Apache License 2.0
License: Apache License 2.0
because world-map.js:16: " projection: (d3.geo.miller || d3.geo.equirectangular)(),", there is no ability for your config option to override
when we fix this, we need to test USMap, worldMap, and map. (i was anecdotally having some weird problems with USMap and i think this just needs regression testing)
currently in choropleth.js we have:
var defaults = {
USChoropleth: {
topoJson: undefined,
feature: 'states',
scale: undefined,
scaleRatio: 1.3333,
}
};
and the examples/demo.html file uses:
d3.json('us-all.json', function (us) {
new Contour({
el: '.map',
tooltip: {
formatter: function (d, i, j) {
return _.template(tooltipTemplate, { name: d.properties.name, population: numberFormatter(populationByState[d.id]) } );
}
}
})
.USChoropleth({
topoJson: us,
cssClass: function (d) { return colorScale(populationByState[d.id]); }
})
.smallStatesCallouts()
.tooltip()
.render();
});
This is somewhat confusing usage. The first argument to .USChoropleth is an object with the data, and in this example, there is no object with configuration information. However, "topoJson" is a option, so it's very easy to accidentally read this code as just passing an options object to .USChoropleth.
For example, when using a different topoJson file than in the demo.html, the actual code needed is:
d3.json('parks.json', function(parks) {
new Contour({
el: '.map',
tooltip: {
formatter: function (d, i, j) {
return _.template(tooltipTemplate, { name: d.properties.name } );
}
}
})
.USChoropleth({
topoJson: parks,
cssClass: function (d) { if (visitedByMolly[d.id]) return "visited"; }
}, {feature: 'subunits'})
.tooltip()
.render();
});
but the demo.html usage somewhat implies that this code should work (it does not):
d3.json('parks.json', function(parks) {
new Contour({
el: '.map',
tooltip: {
formatter: function (d, i, j) {
return _.template(tooltipTemplate, { name: d.properties.name } );
}
}
})
.USChoropleth({
topoJson: parks,
feature: 'subunits',
cssClass: function (d) { if (visitedByMolly[d.id]) return "visited"; }
})
.tooltip()
.render();
});
we need to have features be 'all' rather than 'undefined' by default
per testing w/ @jaimedp
currently, it's required to be an array of arrays:
.marker([[-122, 37], [-87, 41]])
we were thinking it would be nice to also support just one array if you only have one marker:
.marker([-122, 37])
and maybe also an object or array of objects:
.marker({long: -122, lat: 37})
.marker([{long: -122, lat: 37}])
right now, the function has no arguments.
.marker([[-122, 37], [-87, 41]],
{cssClass: function(data) {
alert(data);
return 'northern';
}
})
"data" is undefined
cf marker.js:54 and following.
from d3.geo.projection.center() and .translate()
together with the existing .scale(), these two properties will let us make choropleth subsets that are centered both in the
relates to issue #5
requires docs updates because docs and showcase examples assume default projection of albersUsa
see for example: http://jsfiddle.net/gh/get/jquery/1.11.0/forio/contour-geo/tree/master/examples/showcase/map/world, which errors with "Uncaught TypeError: Cannot read property 'type' of undefined" from "world-map.js:22". I think the problem is that line 20, "options.worldChoropleth" should be options.somethingElse.
in the fiddle, if you change the visualization from "worldMap" to "map" it works fine.
the contour-geo USChoropleth can be used pretty easily to create your own map of anything you want, as long as you pass in the right topojson file.
however, if your topojson is outside of the US, you'll want a different projection than d3.geo.albersUsa. and even if you keep the same data as in our example, you might want the d3.geo.albers projection with Alaska above the continental US.
this issue is a placeholder for testing and additional docs review.
fixed in: e300478...85da897 and forio/contour@24d5fa7...6b376d7
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.