Am beginner for d3.js
. I create a geomap
with using d3.js
.My map is working fine but i have some problem in scaling
.
I need to display my map with full screen of the window.
So i created with using below code.
// Html Part
<div id="world-placeholder" style="width:100%;height:auto;">
</div>
// Script part for generating SVG
<script>
var svg = d3.select('#'+id)
.append('svg');
// Set Width & Hight
var width = $("svg").parent().width();
var height = width/2;
// Set Projection
var projection = d3.geo.robinson()
//.scale(100)
//.scale((width/height)*100)
.translate([width/2, height/2]);
// Set Path
var path = d3.geo.path()
.projection(projection);
</script>
Basically am trying to plot the map with using current width of the screen by using $("svg").parent().width();
So my question is how to stretch my map with full screen.
Result screen Before Scaling (Not used any scaling)
Result Screen After Scaling (Used scale(200) for stretching)
Scaling Code Part
var projection = d3.geo.robinson()
.scale(200)
.translate([width/2, height/2]);
How to Scale dynamically based on window size? or any other way to display a map with full screen for all devices?
Please help me to solve.
Thanks in advance.