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.


                <script src="//"></script>
<script src="//"></script>
<script src="//"></script>
<div id="chartdiv"></div>
<input type="button" value="Add data" id="btn" onclick="addData();" />


                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;

input {
  position: absolute;
  top: 1em;
  right: 1em;
  font-size: 1.2em;
  font-family: "Archivo Narrow";
  padding: 0.5em 2em;


                /* Set themes */

/* Normal data */
var data = [{
    "country": "Lithuania",
    "value": 501.9
}, {
    "country": "Czech Republic",
    "value": 301.9
}, {
    "country": "Ireland",
    "value": 201.1
}, {
    "country": "Germany",
    "value": 165.8
}, {
    "country": "Australia",
    "value": 139.9
}, {
    "country": "Austria",
    "value": 128.3
}, {
    "country": "UK",
    "value": 99
}, {
    "country": "Belgium",
    "value": 60
}, {
    "country": "The Netherlands",
    "value": 50

/* Create chart */
var chart = am4core.create("chartdiv", am4charts.PieChart);
chart.radius = am4core.percent(60);  
chart.innerRadius = am4core.percent(30)

/* Dummy innitial data data */ = [{
  "country": "Dummy",
  "disabled": true,
  "value": 1000,
  "color": am4core.color("#dadada"),
  "opacity": 0.3,
  "strokeDasharray": "4,4",
  "tooltip": ""

/* Create series */
var series = chart.series.push(new am4charts.PieSeries());
series.dataFields.value = "value";
series.dataFields.category = "country";
series.dataFields.hiddenInLegend = "disabled";

/* Set tup slice appearance */
var slice = series.slices.template;
slice.propertyFields.fill = "color";
slice.propertyFields.fillOpacity = "opacity";
slice.propertyFields.stroke = "color";
slice.propertyFields.strokeDasharray = "strokeDasharray";
slice.propertyFields.tooltipText = "tooltip";

series.labels.template.propertyFields.disabled = "disabled";
series.ticks.template.propertyFields.disabled = "disabled";

/* This creates initial animation */ = 1; = -90; = -90;

function addData() {
  /* Set real data */ = data;
  /* Disable button */
  document.getElementById("btn").disabled = true;
  /* Hide series and show again to play the animation */