Giter Club home page Giter Club logo

contour-geo's People

Contributors

breadbaker avatar jaimedp avatar mmrj avatar shimin-zhang avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

contour-geo's Issues

projection option not effective for worldMap

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)

improve separation of topoJson (data) and USChoropleth options

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();
    });

.marker(): support multiple ways to specify the location data

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}])

add 'center' and 'translate' as config property to choropleth

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

with the Contour instance and in the geometry of the map. For example, if your topojson includes just California, the center, translate, and scale properties are what you need to make California big and centered, rather than small and off to the side like a regular albersUsa projection that's just hiding the other states.

relates to issue #5

make projection a configuration option for USChoropleth

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.