Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ 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.


Save Automatically?

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.


                <script src="//"></script>
<script src="//"></script>
<script src="//"></script>
<script src="//"></script>
<div id="chartdiv"></div>


                body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";

#chartdiv {
  width: 100%;
  height: 250px;



 * --------------------------------------------------------
 * This demo was created using amCharts V4 preview release.
 * V4 is the latest installement in amCharts data viz
 * library family, to be released in the first half of
 * 2018.
 * For more information and documentation visit:
 * --------------------------------------------------------

 * This is a demo for MapChart.
 * Refer to the following link(s) for reference:
 * @see {@link}

// Set themes

// Create the map chart
var chart = am4core.create("chartdiv", am4maps.MapChart);

// Check if proper geodata is loaded
try {
	chart.geodata = am4geodata_worldLow;
catch (e) {
		"message": "Map geodata could not be loaded. Please download the latest <a href=\"\">amcharts geodata</a> and extract its contents into the same directory as your amCharts files."

// Set projection to be used
// @see {@link}
chart.projection = new am4maps.projections.Miller();

// Create polygon series
var polygonSeries = chart.series.push(new am4maps.MapPolygonSeries());
polygonSeries.useGeodata = true;
polygonSeries.exclude = ["AQ"]; // Exclude Antractica
polygonSeries.tooltip.fill = am4core.color("#000000");

var colorSet = new am4core.ColorSet();

// Configure polygons
var polygonTemplate = polygonSeries.mapPolygons.template;
polygonTemplate.tooltipText = "{name}";
polygonTemplate.togglable = true;

// Set events to apply "active" state to clicked polygons
var currentActive;"hit", function (event) {
	// if we have some country selected, set default state to it
	if (currentActive) {

	currentActive =;

// Configure states
// @see {@link}

// Configure "hover" state
var hoverState = polygonTemplate.states.create("hover"); = colorSet.getIndex(0);

// Configure "active" state
var activeState = polygonTemplate.states.create("active"); = colorSet.getIndex(4);

// Create a zoom control
var zoomControl = new am4maps.ZoomControl();
chart.zoomControl = zoomControl;
zoomControl.slider.height = 100;

// Add button to zoom out
var home = chart.chartContainer.createChild(am4core.Button);
home.label.text = "Home";
home.align = "right";"hit", function(ev) {