“Fixing” maps for countries that span 180 longitude

Some countries, like New Zealand have islands across that line. This causes the "over the line" parts to be "wrapped" and drawn all the way to the right of the map area. This may not be an issue on a world map, but might look a bit odd for a country only map.

The issue

As we described in preamble, some country maps might look outright odd with their parts that cross anti meridian drawn on the opposite side of the map:

New Zealand's Chatham Islands are too small to see at full zoom, yet they influence the scale of the whole map.

The fix

The solution is easy: we just need to "rotate" the map so that "stray" islands fit next to the mainland.

For that we have deltaLongitude setting of the map.

chart.deltaLongitude = -10;
chart.deltaLongitude = -10;
{
// ...
"deltaLongitude": -10
}

Setting it to -10 will shift the whole map westwards by 10 degrees, which is enough for all of the islands to fit, producing the map as we expect it:

New Zealand is now sized appropriately.

Example

See the Pen amCharts 4: "fixing" map of New Zealand by amCharts team (@amcharts) on CodePen.0