123

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <script src="https://www.amcharts.com/lib/4/core.js"></script>
<script src="https://www.amcharts.com/lib/4/charts.js"></script>
<script src="https://www.amcharts.com/lib/4/themes/animated.js"></script>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam pulvinar non erat sed dapibus. Aenean vitae lobortis justo, ut posuere diam. Vestibulum eget massa maximus dui posuere posuere. Phasellus eget tortor ipsum. Integer sollicitudin ex lacus, condimentum mollis <div id="chartdiv"></div> neque finibus in. Nam et justo at nisi tincidunt auctor non quis nisl. Curabitur tempor pellentesque justo eu mattis. Suspendisse potenti. Aenean at convallis lacus. Aliquam vitae eros ornare, facilisis tellus at, rutrum nibh. Duis ac nisl ac neque hendrerit finibus nec non dolor. Morbi non viverra tortor, eu auctor lorem. Pellentesque posuere, justo eget sollicitudin viverra, quam nisl molestie sapien, in viverra turpis justo venenatis <div id="chartdiv2"></div> massa. Pellentesque ac diam sit amet arcu feugiat eleifend non sit amet dui.


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

#chartdiv {
  width: 80px;
  height: 20px;
  display: inline-block;
  vertical-align: middle;
}

#chartdiv2 {
  width: 20px;
  height: 20px;
  display: inline-block;
  vertical-align: middle;
}

            
          
!
            
              /**
 * --------------------------------------------------------
 * 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:
 * https://www.amcharts.com/docs/v4/
 * --------------------------------------------------------
 */

am4core.useTheme(am4themes_animated);

var chart = am4core.create("chartdiv", am4charts.XYChart);

chart.data = [ {
		"date": new Date(2018, 0, 1, 8, 0, 0),
		"value": 57
	}, {
		"date": new Date(2018, 0, 1, 9, 0, 0),
		"value": 27
	}, {
		"date": new Date(2018, 0, 1, 10, 0, 0),
		"value": 24
	}, {
		"date": new Date(2018, 0, 1, 11, 0, 0),
		"value": 59
	}, {
		"date": new Date(2018, 0, 1, 12, 0, 0),
		"value": 33
	}, {
		"date": new Date(2018, 0, 1, 13, 0, 0),
		"value": 46
	}, {
		"date": new Date(2018, 0, 1, 14, 0, 0),
		"value": 20
	}, {
		"date": new Date(2018, 0, 1, 15, 0, 0),
		"value": 42
	}, {
		"date": new Date(2018, 0, 1, 16, 0, 0),
		"value": 59,
    "opacity": 1
	}
];

chart.padding(0, 0, 0, 0);

var dateAxis = chart.xAxes.push(new am4charts.DateAxis());
dateAxis.renderer.grid.template.disabled = true;
dateAxis.renderer.labels.template.disabled = true;
dateAxis.startLocation = 0.5;
dateAxis.endLocation = 0.7;
dateAxis.cursorTooltipEnabled = false;

var valueAxis = chart.yAxes.push(new am4charts.ValueAxis());
valueAxis.min = 0;
valueAxis.renderer.grid.template.disabled = true;
valueAxis.renderer.baseGrid.disabled = true;
valueAxis.renderer.labels.template.disabled = true;
valueAxis.cursorTooltipEnabled = false;

chart.cursor = new am4charts.XYCursor();
chart.cursor.lineY.disabled = true;

var series = chart.series.push(new am4charts.LineSeries());
series.tooltipText = "{date}: [bold]{value}";
series.dataFields.dateX = "date";
series.dataFields.valueY = "value";
series.tensionX = 0.8;
series.strokeWidth = 2;

// render data points as bullets
var bullet = series.bullets.push(new am4charts.CircleBullet());
bullet.circle.opacity = 0;
bullet.circle.propertyFields.opacity = "opacity";
bullet.circle.radius = 3;

// Create chart instance
var chart2 = am4core.create("chartdiv2", am4charts.PieChart);

// Add data
chart2.data = [{
  "country": "Lithuania",
  "litres": 501.9
}, {
  "country": "Czech Republic",
  "litres": 301.9
}, {
  "country": "Ireland",
  "litres": 201.1
}, {
  "country": "Germany",
  "litres": 165.8
}];

// Remove padding
chart2.padding(0, 0, 0, 0);

// Add and configure Series
var pieSeries = chart2.series.push(new am4charts.PieSeries());
pieSeries.dataFields.value = "litres";
pieSeries.dataFields.category = "country";
pieSeries.labels.template.disabled = true;
pieSeries.ticks.template.disabled = true;

chart2.chartContainer.minHeight = 20;
chart2.chartContainer.minWidth = 20;
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console