Enlarge a path map with D3.js

Asked

Viewed 135 times

0

I am creating a map of a state using D3.js and the code takes the data from a Geojson file I can show the map of the screen but with very small size. I cannot use the . Scale() and . Translate([]) functions to change the size of the map. the file Geojson follow on this link the code follows below.

test

</head>
<body>

    <script>

       var canvas = d3.select("body").append("svg").style("background-color","#ccc")
            .attr("width", 700)
            .attr("height", 700)


        d3.json("geojs-15-mun.json",function(data){

           var group = canvas.selectAll("g")
                   .data(data.features)
                   .enter()
                   .append("g")

           var projection = d3.geo.mercator();

           var path = d3.geo.path().projection(projection);

           var areas = group.append("path")
                   .attr("d",path)
                   .attr("class","area")
                   .attr("fill","steelblue");




        });


    </script>

</body>

  • Can you get the most complete code so I can test?

  • the full file is en.stackoverflow.com/q/239598/89191 works on firefox. Only Geojson is in the question link.I am using D3.v3

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.