Pen Settings

HTML

CSS

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

JavaScript

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

Packages

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.

Behavior

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.

HTML

              
                <script src="//www.amcharts.com/lib/4/core.js"></script>
<script src="//www.amcharts.com/lib/4/charts.js"></script>
<script src="//www.amcharts.com/lib/4/themes/animated.js"></script>
<script src="//www.amcharts.com/lib/4/themes/kelly.js"></script>
<div id="chartdiv"></div>
              
            
!

CSS

              
                body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
}
#chartdiv {
  width: 600px;
  height: 97vh;
  margin: 0 auto;
}

              
            
!

JS

              
                /**
 * ---------------------------------------
 * This demo was created using amCharts 4.
 *
 * For more information visit:
 * https://www.amcharts.com/
 *
 * Documentation is available at:
 * https://www.amcharts.com/docs/v4/
 * ---------------------------------------
 */

// Apply chart themes
am4core.useTheme( am4themes_animated );

var chart = am4core.create( "chartdiv", am4charts.XYChart );
chart.hiddenState.properties.opacity = 0; // this creates initial fade-in

chart.maskBullets = false;

var xAxis = chart.xAxes.push( new am4charts.CategoryAxis() );
var yAxis = chart.yAxes.push( new am4charts.CategoryAxis() );

xAxis.dataFields.category = "x";
yAxis.dataFields.category = "y";

xAxis.renderer.grid.template.disabled = true;
xAxis.renderer.minGridDistance = 40;

yAxis.renderer.grid.template.disabled = true;
yAxis.renderer.inversed = true;
yAxis.renderer.minGridDistance = 30;

var series = chart.series.push( new am4charts.ColumnSeries() );
series.dataFields.categoryX = "x";
series.dataFields.categoryY = "y";
series.dataFields.value = "value";
series.sequencedInterpolation = true;
series.defaultState.transitionDuration = 3000;

// Set up column appearance
var column = series.columns.template;
column.strokeWidth = 2;
column.strokeOpacity = 1;
column.stroke = am4core.color( "#ffffff" );
column.tooltipText = "{x}, {y}: {value.workingValue.formatNumber('#.')}";
column.width = am4core.percent( 100 );
column.height = am4core.percent( 100 );
column.column.cornerRadius(6, 6, 6, 6);
column.propertyFields.fill = "color";

// Set up bullet appearance
var bullet1 = series.bullets.push(new am4charts.CircleBullet());
bullet1.circle.propertyFields.radius = "value";
bullet1.circle.fill = am4core.color("#000");
bullet1.circle.strokeWidth = 0;
bullet1.circle.fillOpacity = 0.7;
bullet1.interactionsEnabled = false;

var bullet2 = series.bullets.push(new am4charts.LabelBullet());
bullet2.label.text = "{value}";
bullet2.label.fill = am4core.color("#fff");
bullet2.zIndex = 1;
bullet2.fontSize = 11;
bullet2.interactionsEnabled = false;

// define colors
var colors = {
	"critical": "#ca0101",
	"bad": "#e17a2d",
	"medium": "#e1d92d",
	"good": "#5dbe24",
	"verygood": "#0b7d03"
};

chart.data = [ {
	"y": "Critical",
	"x": "Very good",
	"color": colors.medium,
	"value": 20
}, {
	"y": "Bad",
	"x": "Very good",
	"color": colors.good,
	"value": 15
}, {
	"y": "Medium",
	"x": "Very good",
	"color": colors.verygood,
	"value": 25
}, {
	"y": "Good",
	"x": "Very good",
	"color": colors.verygood,
	"value": 15
}, {
	"y": "Very good",
	"x": "Very good",
	"color": colors.verygood,
	"value": 12
},

{
	"y": "Critical",
	"x": "Good",
	"color": colors.bad,
	"value": 30
}, {
	"y": "Bad",
	"x": "Good",
	"color": colors.medium,
	"value": 24
}, {
	"y": "Medium",
	"x": "Good",
	"color": colors.good,
	"value": 25
}, {
	"y": "Good",
	"x": "Good",
	"color": colors.verygood,
	"value": 15
}, {
	"y": "Very good",
	"x": "Good",
	"color": colors.verygood,
	"value": 25
},

{
	"y": "Critical",
	"x": "Medium",
	"color": colors.bad,
	"value": 33
}, {
	"y": "Bad",
	"x": "Medium",
	"color": colors.bad,
	"value": 14
}, {
	"y": "Medium",
	"x": "Medium",
	"color": colors.medium,
	"value": 20
}, {
	"y": "Good",
	"x": "Medium",
	"color": colors.good,
	"value": 19
}, {
	"y": "Very good",
	"x": "Medium",
	"color": colors.good,
	"value": 25
},

{
	"y": "Critical",
	"x": "Bad",
	"color": colors.critical,
	"value": 31
}, {
	"y": "Bad",
	"x": "Bad",
	"color": colors.critical,
	"value": 24
}, {
	"y": "Medium",
	"x": "Bad",
	"color": colors.bad,
	"value": 25
}, {
	"y": "Good",
	"x": "Bad",
	"color": colors.medium,
	"value": 15
}, {
	"y": "Very good",
	"x": "Bad",
	"color": colors.good,
	"value": 15
},

{
	"y": "Critical",
	"x": "Critical",
	"color": colors.critical,
	"value": 12
}, {
	"y": "Bad",
	"x": "Critical",
	"color": colors.critical,
	"value": 14
}, {
	"y": "Medium",
	"x": "Critical",
	"color": colors.critical,
	"value": 15
}, {
	"y": "Good",
	"x": "Critical",
	"color": colors.bad,
	"value": 25
}, {
	"y": "Very good",
	"x": "Critical",
	"color": colors.medium,
	"value": 19
}
];
              
            
!
999px

Console