ComposableMap height and width props explained
See original GitHub issueWhen 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>
I am using the world-110m file here
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (4 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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.
Width and height is so confusing because it is the input to the SVG’s viewbox:
Its essentially setting the internal dimensions with
overflow: hidden
while the css styles and domwidth
andheight
(the same by default) distort the external image.