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>
<input type="button" value="Set empty data" onclick="setEmpty();" />
<input type="button" value="Set regular data" onclick="setRegular();" />
<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: 500px;



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

// Create root and chart
var root ="chartdiv");


var chart = root.container.children.push(, {
    layout: root.verticalLayout

// Create series
var series = chart.series.push(, {
    name: "Series",
    valueField: "sales",
    categoryField: "country"

// Create modal for a "no data" note
var modal =, {
  content: "The chart has no data"
});"datavalidated", function(ev) {
  var series =;
  if ( < 1) {  
    // Generate placeholder data
    var categoryField = series.get("categoryField");
    var valueField = series.get("valueField");
    var placeholder = [];
    for (i = 0; i < 3; i++) {
      var item = {};
      item[categoryField] = "";
      item[valueField] = 1;
    // Disable ticks/labels
    series.labels.template.set("forceHidden", true);
    series.ticks.template.set("forceHidden", true);
    // Show modal;
  else {
    // Re-enable ticks/labels
    series.labels.template.set("forceHidden", false);
    series.ticks.template.set("forceHidden", false);
    // Hide modal


// Add legend
var legend = chart.children.push(, {
	centerX: am5.percent(50),
  x: am5.percent(50),
	layout: root.horizontalLayout

function setEmpty() {[]);

function setRegular() {[{
    country: "France",
    sales: 100000
  }, {
    country: "Spain",
    sales: 160000
  }, {
    country: "United Kingdom",
    sales: 80000