bjornd / jvectormap

jvectormap.com
GNU Affero General Public License v3.0
1.38k stars 431 forks source link

jVectorMap renders at the wrong size and there does not appear to be a way to change it #440

Open VivekTodur opened 6 years ago

VivekTodur commented 6 years ago

I'm using jVectorMap (latest version 2.0.3) to create a map inside of a div.

However, no matter what I do, the map takes up only a small portion of the div. It seems that it is due to

I have tried setting the size on the containing div, I've tried various css solutions, but it still doesn't allow me to resize. The background color resizes, but the SVG element simply does not.

How do I resize the SVG element with jVectorMap?

Here is my script:

<script>
$('#map').vectorMap({
 map: 'world_mill_en',
  regionsSelectable: 1,
  regionStyle: {
  initial: {
    fill: 'white',
    "fill-opacity": 1,
    stroke: 'none',
    "stroke-width": 0,
    "stroke-opacity": 1
  },
  hover: {
    "fill-opacity": 0.8
  },
  selected: {
    fill: 'blue'
  },
  selectedHover: {
  }
  }
});
</script>
fdominik commented 6 years ago

Hm strange, it works for me. I don't need to set any size to the SVG element. I just set width and height to the parent DIV of the whole map. You can see my working map at https://sevenhillsaway.com/map/, also I am using @media tag and for different resolution sizes I render the div with different sizes. So where would be your problem?

jimmygp26 commented 5 years ago

I had same issue, however I found that css was not properly included, I fixed it and now is working