Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <!-- Google includes -->
<script src="" defer></script>

<!-- amCharts includes -->
<script src=""></script>
<script src=""></script>
<script src=""></script>

<!-- HTML -->
<div id="maps">
  <div id="gmap" class="mapdiv" style="visibility: visible;"></div>
  <div id="ammap" class="mapdiv" style="visibility: visible;"></div>


                #maps {
  width: 510px;
  height: 500px;
  border: 0px solid #eee;
  margin: 0px auto;
  position: relative;

.mapdiv {
  width: 510px;
  height: 500px;
  position: absolute;
  top: 0;
  left: 0;


 * ---------------------------------------
 * This demo was created using amCharts 4.
 * For more information visit:
 * Documentation is available at:
 * ---------------------------------------

 * Create the Google Map
var gmap;

function initGoogleMap() {
  gmap = new google.maps.Map(document.getElementById("gmap"), {
    scrollwheel: true,
    disableDefaultUI: true

 * Create the amCharts Map

// Create map instance
var ammap = am4core.create("ammap", am4maps.MapChart);
ammap.geodata = am4geodata_worldLow;
ammap.projection = new am4maps.projections.Mercator();
ammap.zoomDuration = 0;

var polygonSeries = ammap.series.push(new am4maps.MapPolygonSeries());
polygonSeries.exclude = ["AQ"];
polygonSeries.useGeodata = true;

// Add zoom control
ammap.zoomControl = new am4maps.ZoomControl();

// Configure series
var polygonTemplate = polygonSeries.mapPolygons.template;
polygonTemplate.tooltipText = "{name}";
polygonTemplate.fill = am4core.color("#74B266");
polygonTemplate.fillOpacity = 0.5;

var hs = polygonTemplate.states.create("hover"); = am4core.color("#367B25");

// Set up GMap centering"zoomlevelchanged", updateMapPosition);"mappositionchanged", updateMapPosition);"scaleratiochanged", updateMapPosition);

function updateMapPosition(ev) {
   * GMap inited?
  if ( typeof gmap === "undefined" )

  // set google map zoom level:
  gmap.setZoom(Math.log2(ammap.zoomLevel) + 1);

  // sync position
  gmap.setCenter( {
    // a small adjustment needed for this div size:
    lat: ammap.zoomGeoPoint.latitude,
    lng: ammap.zoomGeoPoint.longitude
  } );