question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ComposableMap height and width props explained

See original GitHub issue

When using a ComposableGraph, I was expecting to be able to set a width and height property and see the entire atlas drawn within those dimensions. Instead, I am seeing a cropped atlas if my width/height properties are not set large enough. I thought that given a zoom of 1, all the geographies should be visible no matter what size I choose to set the ComposableGraph.

<ComposableMap
  projectionConfig={{
    scale: 205,
    rotation: [-11, 0, 0],
  }}
  width={800}
  height={400}
>
  <ZoomableGroup disablePanning zoom={1}>
    <Geographies geography={`${process.env.PUBLIC_URL}/map.json`} disableOptimization>
      ...
    </Geographies>
  </ZoomableGroup>
</ComposableMap>

atlas

I am using the world-110m file here

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
bonboniocommented, Feb 9, 2019

I agree it works confusingly; I would expect it to fit to the size of whatever containing sizes I set, without anything being cropped, it should also center in that container on both axis.

1reaction
d3dccommented, May 3, 2019

Width and height is so confusing because it is the input to the SVG’s viewbox:

viewBox={ viewBox ? viewBox : `0 0 ${width} ${height}` }

Its essentially setting the internal dimensions with overflow: hidden while the css styles and dom width and height (the same by default) distort the external image.

Read more comments on GitHub >

github_iconTop Results From Across the Web

react-simple-maps.ComposableMap JavaScript and Node.js ...
Best JavaScript code snippets using react-simple-maps.ComposableMap(Showing top 4 results out of 315) ; projectionConfig={{ scale }} width={width}.
Read more >
Composable map - React Simple Maps
By default react-simple-maps renders a map based on a 800x600 SVG coordinate system. You can change these dimensions using the width and height...
Read more >
React Simple Maps with....React16! - YouTube
I'll make an addition to the video with the correction soon enough explaining al the changes in detail. Thanks ปั้นพอร์ต for bringing it...
Read more >
Building choropleth map (heatmap) of India in Javascript ...
For creating our Map Component, we'll use ComposableMap from react-simple-maps. import { ComposableMap, Geographies ... width={600} height={220} data-tip=""
Read more >
How to use the chroma-js.scale function in chroma-js - Snyk
constructor(props) { super(props); this.state = { texture: props.texture, height: props.height, width: props.width, markers: [], lights: [], selectedMarker: ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found