Documentation v8.0.25

Preview Purchase

Overview

AmChartsis programming library for all your data visualization needs. You can download and use it for free. The only limitation of the free version is that a small link to this web site will be displayed in the top left corner of your charts. If you would like to use charts without this link, or you appreciate the software and would like to support its creators, please purchase a commercial license. For more info please check AmCharts Home.
Exclusively for Keenthemes users
After purchasing Metronic you will get a promo code for 15% discountoff the commercial license of AmChart. To find the promo code please check the README file in the purchased package.

Usage

To use AmChartsin your page you will need to include
<script src="https://cdn.amcharts.com/lib/4/core.js"></script>
<script src="https://cdn.amcharts.com/lib/4/charts.js"></script>
<script src="https://cdn.amcharts.com/lib/4/themes/animated.js"></script>

Basic Stock Chart

Simply define a blank divwith a unique idin your HTML markup. Then initialize the chart via javascript.
am4core.ready(function () {

    // Themes begin
    am4core.useTheme(am4themes_animated);
    // Themes end

    // Create chart
    chart = am4core.create('kt_amcharts_1', am4charts.XYChart);
    chart.padding(0, 15, 0, 15);

    // Load external data
    chart.dataSource.url = 'https://www.amcharts.com/wp-content/uploads/assets/stock/MSFT.csv';
    chart.dataSource.parser = new am4core.CSVParser();
    chart.dataSource.parser.options.useColumnNames = true;
    chart.dataSource.parser.options.reverse = true;

    // the following line makes value axes to be arranged vertically.
    chart.leftAxesContainer.layout = 'vertical';

    // uncomment this line if you want to change order of axes
    //chart.bottomAxesContainer.reverseOrder = true;

    var dateAxis = chart.xAxes.push(new am4charts.DateAxis());
    dateAxis.renderer.grid.template.location = 0;
    dateAxis.renderer.ticks.template.length = 8;
    dateAxis.renderer.ticks.template.strokeOpacity = 0.1;
    dateAxis.renderer.grid.template.disabled = true;
    dateAxis.renderer.ticks.template.disabled = false;
    dateAxis.renderer.ticks.template.strokeOpacity = 0.2;
    dateAxis.renderer.minLabelPosition = 0.01;
    dateAxis.renderer.maxLabelPosition = 0.99;
    dateAxis.keepSelection = true;
    dateAxis.minHeight = 30;

    dateAxis.groupData = true;
    dateAxis.minZoomCount = 5;

    // these two lines makes the axis to be initially zoomed-in
    // dateAxis.start = 0.7;
    // dateAxis.keepSelection = true;

    var valueAxis = chart.yAxes.push(new am4charts.ValueAxis());
    valueAxis.tooltip.disabled = true;
    valueAxis.zIndex = 1;
    valueAxis.renderer.baseGrid.disabled = true;
    // height of axis
    valueAxis.height = am4core.percent(65);

    valueAxis.renderer.gridContainer.background.fill = am4core.color('#000000');
    valueAxis.renderer.gridContainer.background.fillOpacity = 0.05;
    valueAxis.renderer.inside = true;
    valueAxis.renderer.labels.template.verticalCenter = 'bottom';
    valueAxis.renderer.labels.template.padding(2, 2, 2, 2);

    //valueAxis.renderer.maxLabelPosition = 0.95;
    valueAxis.renderer.fontSize = '0.8em'

    var series = chart.series.push(new am4charts.LineSeries());
    series.dataFields.dateX = 'Date';
    series.dataFields.valueY = 'Adj Close';
    series.tooltipText = '{valueY.value}';
    series.name = 'MSFT: Value';
    series.defaultState.transitionDuration = 0;

    var valueAxis2 = chart.yAxes.push(new am4charts.ValueAxis());
    valueAxis2.tooltip.disabled = true;
    // height of axis
    valueAxis2.height = am4core.percent(35);
    valueAxis2.zIndex = 3
    // this makes gap between panels
    valueAxis2.marginTop = 30;
    valueAxis2.renderer.baseGrid.disabled = true;
    valueAxis2.renderer.inside = true;
    valueAxis2.renderer.labels.template.verticalCenter = 'bottom';
    valueAxis2.renderer.labels.template.padding(2, 2, 2, 2);
    //valueAxis.renderer.maxLabelPosition = 0.95;
    valueAxis2.renderer.fontSize = '0.8em'

    valueAxis2.renderer.gridContainer.background.fill = am4core.color('#000000');
    valueAxis2.renderer.gridContainer.background.fillOpacity = 0.05;

    var series2 = chart.series.push(new am4charts.ColumnSeries());
    series2.dataFields.dateX = 'Date';
    series2.dataFields.valueY = 'Volume';
    series2.yAxis = valueAxis2;
    series2.tooltipText = '{valueY.value}';
    series2.name = 'MSFT: Volume';
    // volume should be summed
    series2.groupFields.valueY = 'sum';
    series2.defaultState.transitionDuration = 0;

    chart.cursor = new am4charts.XYCursor();

    var scrollbarX = new am4charts.XYChartScrollbar();
    scrollbarX.series.push(series);
    scrollbarX.marginBottom = 20;
    scrollbarX.scrollbarChart.xAxes.getIndex(0).minHeight = undefined;
    chart.scrollbarX = scrollbarX;

}); // end am4core.ready()
<div class="card card-bordered">
    <div class="card-body">
        <div id="kt_amcharts_1" style="height: 500px;"></div>
    </div>
</div>

<script src="https://cdn.amcharts.com/lib/4/plugins/rangeSelector.js"></script>

Stock Comparison Chart

Simply define a blank divwith a unique idin your HTML markup. Then initialize the chart via javascript.
am4core.ready(function () {

    // Themes begin
    am4core.useTheme(am4themes_animated);
    // Themes end

    var chart = am4core.create('kt_amcharts_2', am4charts.XYChart);
    chart.padding(0, 15, 0, 15);
    chart.colors.step = 3;

    var data = [];
    var price1 = 1000;
    var price2 = 2000;
    var price3 = 3000;
    var quantity = 1000;
    for (var i = 15; i < 3000; i++) {
        price1 += Math.round((Math.random() < 0.5 ? 1 : -1) * Math.random() * 100);
        price2 += Math.round((Math.random() < 0.5 ? 1 : -1) * Math.random() * 100);
        price3 += Math.round((Math.random() < 0.5 ? 1 : -1) * Math.random() * 100);

        if (price1 < 100) {
            price1 = 100;
        }

        if (price2 < 100) {
            price2 = 100;
        }

        if (price3 < 100) {
            price3 = 100;
        }

        quantity += Math.round((Math.random() < 0.5 ? 1 : -1) * Math.random() * 500);

        if (quantity < 0) {
            quantity *= -1;
        }
        data.push({ date: new Date(2000, 0, i), price1: price1, price2: price2, price3: price3, quantity: quantity });
    }


    chart.data = data;
    // the following line makes value axes to be arranged vertically.
    chart.leftAxesContainer.layout = 'vertical';

    // uncomment this line if you want to change order of axes
    //chart.bottomAxesContainer.reverseOrder = true;

    var dateAxis = chart.xAxes.push(new am4charts.DateAxis());
    dateAxis.renderer.grid.template.location = 0;
    dateAxis.renderer.ticks.template.length = 8;
    dateAxis.renderer.ticks.template.strokeOpacity = 0.1;
    dateAxis.renderer.grid.template.disabled = true;
    dateAxis.renderer.ticks.template.disabled = false;
    dateAxis.renderer.ticks.template.strokeOpacity = 0.2;
    dateAxis.renderer.minLabelPosition = 0.01;
    dateAxis.renderer.maxLabelPosition = 0.99;
    dateAxis.keepSelection = true;

    dateAxis.groupData = true;
    dateAxis.minZoomCount = 5;

    // these two lines makes the axis to be initially zoomed-in
    // dateAxis.start = 0.7;
    // dateAxis.keepSelection = true;

    var valueAxis = chart.yAxes.push(new am4charts.ValueAxis());
    valueAxis.tooltip.disabled = true;
    valueAxis.zIndex = 1;
    valueAxis.renderer.baseGrid.disabled = true;
    // height of axis
    valueAxis.height = am4core.percent(65);

    valueAxis.renderer.gridContainer.background.fill = am4core.color('#000000');
    valueAxis.renderer.gridContainer.background.fillOpacity = 0.05;
    valueAxis.renderer.inside = true;
    valueAxis.renderer.labels.template.verticalCenter = 'bottom';
    valueAxis.renderer.labels.template.padding(2, 2, 2, 2);

    //valueAxis.renderer.maxLabelPosition = 0.95;
    valueAxis.renderer.fontSize = '0.8em'

    var series1 = chart.series.push(new am4charts.LineSeries());
    series1.dataFields.dateX = 'date';
    series1.dataFields.valueY = 'price1';
    series1.dataFields.valueYShow = 'changePercent';
    series1.tooltipText = '{name}: {valueY.changePercent.formatNumber('[#0c0]+#.00|[#c00]#.##|0')}%';
    series1.name = 'Stock A';
    series1.tooltip.getFillFromObject = false;
    series1.tooltip.getStrokeFromObject = true;
    series1.tooltip.background.fill = am4core.color('#fff');
    series1.tooltip.background.strokeWidth = 2;
    series1.tooltip.label.fill = series1.stroke;

    var series2 = chart.series.push(new am4charts.LineSeries());
    series2.dataFields.dateX = 'date';
    series2.dataFields.valueY = 'price2';
    series2.dataFields.valueYShow = 'changePercent';
    series2.tooltipText = '{name}: {valueY.changePercent.formatNumber('[#0c0]+#.00|[#c00]#.##|0')}%';
    series2.name = 'Stock B';
    series2.tooltip.getFillFromObject = false;
    series2.tooltip.getStrokeFromObject = true;
    series2.tooltip.background.fill = am4core.color('#fff');
    series2.tooltip.background.strokeWidth = 2;
    series2.tooltip.label.fill = series2.stroke;

    var series3 = chart.series.push(new am4charts.LineSeries());
    series3.dataFields.dateX = 'date';
    series3.dataFields.valueY = 'price3';
    series3.dataFields.valueYShow = 'changePercent';
    series3.tooltipText = '{name}: {valueY.changePercent.formatNumber('[#0c0]+#.00|[#c00]#.##|0')}%';
    series3.name = 'Stock C';
    series3.tooltip.getFillFromObject = false;
    series3.tooltip.getStrokeFromObject = true;
    series3.tooltip.background.fill = am4core.color('#fff');
    series3.tooltip.background.strokeWidth = 2;
    series3.tooltip.label.fill = series3.stroke;

    var valueAxis2 = chart.yAxes.push(new am4charts.ValueAxis());
    valueAxis2.tooltip.disabled = true;
    // height of axis
    valueAxis2.height = am4core.percent(35);
    valueAxis2.zIndex = 3
    // this makes gap between panels
    valueAxis2.marginTop = 30;
    valueAxis2.renderer.baseGrid.disabled = true;
    valueAxis2.renderer.inside = true;
    valueAxis2.renderer.labels.template.verticalCenter = 'bottom';
    valueAxis2.renderer.labels.template.padding(2, 2, 2, 2);
    //valueAxis.renderer.maxLabelPosition = 0.95;
    valueAxis2.renderer.fontSize = '0.8em';

    valueAxis2.renderer.gridContainer.background.fill = am4core.color('#000000');
    valueAxis2.renderer.gridContainer.background.fillOpacity = 0.05;

    var volumeSeries = chart.series.push(new am4charts.StepLineSeries());
    volumeSeries.fillOpacity = 1;
    volumeSeries.fill = series1.stroke;
    volumeSeries.stroke = series1.stroke;
    volumeSeries.dataFields.dateX = 'date';
    volumeSeries.dataFields.valueY = 'quantity';
    volumeSeries.yAxis = valueAxis2;
    volumeSeries.tooltipText = 'Volume: {valueY.value}';
    volumeSeries.name = 'Series 2';
    // volume should be summed
    volumeSeries.groupFields.valueY = 'sum';
    volumeSeries.tooltip.label.fill = volumeSeries.stroke;
    chart.cursor = new am4charts.XYCursor();

    var scrollbarX = new am4charts.XYChartScrollbar();
    scrollbarX.series.push(series1);
    scrollbarX.marginBottom = 20;
    var sbSeries = scrollbarX.scrollbarChart.series.getIndex(0);
    sbSeries.dataFields.valueYShow = undefined;
    chart.scrollbarX = scrollbarX;

}); // end am4core.ready()
<div class="card card-bordered">
    <div class="card-body">
        <div id="kt_amcharts_2" style="height: 500px;"></div>
    </div>
</div>

<script src="https://cdn.amcharts.com/lib/4/plugins/rangeSelector.js"></script>

Variance indicators Chart

Simply define a blank divwith a unique idin your HTML markup. Then initialize the chart via javascript. A clever use of highly configurable clustered Column series and adapters allows automatically-calculated variance indicators.
am4core.ready(function () {

    // Themes begin
    am4core.useTheme(am4themes_animated);
    // Themes end

    var chart = am4core.create('kt_amcharts_3', am4charts.XYChart);
    chart.padding(0, 15, 0, 15);
    chart.colors.step = 3;

    var data = [];
    var price1 = 1000;
    var price2 = 2000;
    var price3 = 3000;
    var quantity = 1000;
    for (var i = 15; i < 3000; i++) {
        price1 += Math.round((Math.random() < 0.5 ? 1 : -1) * Math.random() * 100);
        price2 += Math.round((Math.random() < 0.5 ? 1 : -1) * Math.random() * 100);
        price3 += Math.round((Math.random() < 0.5 ? 1 : -1) * Math.random() * 100);

        if (price1 < 100) {
            price1 = 100;
        }

        if (price2 < 100) {
            price2 = 100;
        }

        if (price3 < 100) {
            price3 = 100;
        }

        quantity += Math.round((Math.random() < 0.5 ? 1 : -1) * Math.random() * 500);

        if (quantity < 0) {
            quantity *= -1;
        }
        data.push({ date: new Date(2000, 0, i), price1: price1, price2: price2, price3: price3, quantity: quantity });
    }


    chart.data = data;
    // the following line makes value axes to be arranged vertically.
    chart.leftAxesContainer.layout = 'vertical';

    // uncomment this line if you want to change order of axes
    //chart.bottomAxesContainer.reverseOrder = true;

    var dateAxis = chart.xAxes.push(new am4charts.DateAxis());
    dateAxis.renderer.grid.template.location = 0;
    dateAxis.renderer.ticks.template.length = 8;
    dateAxis.renderer.ticks.template.strokeOpacity = 0.1;
    dateAxis.renderer.grid.template.disabled = true;
    dateAxis.renderer.ticks.template.disabled = false;
    dateAxis.renderer.ticks.template.strokeOpacity = 0.2;
    dateAxis.renderer.minLabelPosition = 0.01;
    dateAxis.renderer.maxLabelPosition = 0.99;
    dateAxis.keepSelection = true;

    dateAxis.groupData = true;
    dateAxis.minZoomCount = 5;

    // these two lines makes the axis to be initially zoomed-in
    // dateAxis.start = 0.7;
    // dateAxis.keepSelection = true;

    var valueAxis = chart.yAxes.push(new am4charts.ValueAxis());
    valueAxis.tooltip.disabled = true;
    valueAxis.zIndex = 1;
    valueAxis.renderer.baseGrid.disabled = true;
    // height of axis
    valueAxis.height = am4core.percent(65);

    valueAxis.renderer.gridContainer.background.fill = am4core.color('#000000');
    valueAxis.renderer.gridContainer.background.fillOpacity = 0.05;
    valueAxis.renderer.inside = true;
    valueAxis.renderer.labels.template.verticalCenter = 'bottom';
    valueAxis.renderer.labels.template.padding(2, 2, 2, 2);

    //valueAxis.renderer.maxLabelPosition = 0.95;
    valueAxis.renderer.fontSize = '0.8em'

    var series1 = chart.series.push(new am4charts.LineSeries());
    series1.dataFields.dateX = 'date';
    series1.dataFields.valueY = 'price1';
    series1.dataFields.valueYShow = 'changePercent';
    series1.tooltipText = '{name}: {valueY.changePercent.formatNumber('[#0c0]+#.00|[#c00]#.##|0')}%';
    series1.name = 'Stock A';
    series1.tooltip.getFillFromObject = false;
    series1.tooltip.getStrokeFromObject = true;
    series1.tooltip.background.fill = am4core.color('#fff');
    series1.tooltip.background.strokeWidth = 2;
    series1.tooltip.label.fill = series1.stroke;

    var series2 = chart.series.push(new am4charts.LineSeries());
    series2.dataFields.dateX = 'date';
    series2.dataFields.valueY = 'price2';
    series2.dataFields.valueYShow = 'changePercent';
    series2.tooltipText = '{name}: {valueY.changePercent.formatNumber('[#0c0]+#.00|[#c00]#.##|0')}%';
    series2.name = 'Stock B';
    series2.tooltip.getFillFromObject = false;
    series2.tooltip.getStrokeFromObject = true;
    series2.tooltip.background.fill = am4core.color('#fff');
    series2.tooltip.background.strokeWidth = 2;
    series2.tooltip.label.fill = series2.stroke;

    var series3 = chart.series.push(new am4charts.LineSeries());
    series3.dataFields.dateX = 'date';
    series3.dataFields.valueY = 'price3';
    series3.dataFields.valueYShow = 'changePercent';
    series3.tooltipText = '{name}: {valueY.changePercent.formatNumber('[#0c0]+#.00|[#c00]#.##|0')}%';
    series3.name = 'Stock C';
    series3.tooltip.getFillFromObject = false;
    series3.tooltip.getStrokeFromObject = true;
    series3.tooltip.background.fill = am4core.color('#fff');
    series3.tooltip.background.strokeWidth = 2;
    series3.tooltip.label.fill = series3.stroke;

    var valueAxis2 = chart.yAxes.push(new am4charts.ValueAxis());
    valueAxis2.tooltip.disabled = true;
    // height of axis
    valueAxis2.height = am4core.percent(35);
    valueAxis2.zIndex = 3
    // this makes gap between panels
    valueAxis2.marginTop = 30;
    valueAxis2.renderer.baseGrid.disabled = true;
    valueAxis2.renderer.inside = true;
    valueAxis2.renderer.labels.template.verticalCenter = 'bottom';
    valueAxis2.renderer.labels.template.padding(2, 2, 2, 2);
    //valueAxis.renderer.maxLabelPosition = 0.95;
    valueAxis2.renderer.fontSize = '0.8em';

    valueAxis2.renderer.gridContainer.background.fill = am4core.color('#000000');
    valueAxis2.renderer.gridContainer.background.fillOpacity = 0.05;

    var volumeSeries = chart.series.push(new am4charts.StepLineSeries());
    volumeSeries.fillOpacity = 1;
    volumeSeries.fill = series1.stroke;
    volumeSeries.stroke = series1.stroke;
    volumeSeries.dataFields.dateX = 'date';
    volumeSeries.dataFields.valueY = 'quantity';
    volumeSeries.yAxis = valueAxis2;
    volumeSeries.tooltipText = 'Volume: {valueY.value}';
    volumeSeries.name = 'Series 2';
    // volume should be summed
    volumeSeries.groupFields.valueY = 'sum';
    volumeSeries.tooltip.label.fill = volumeSeries.stroke;
    chart.cursor = new am4charts.XYCursor();

    var scrollbarX = new am4charts.XYChartScrollbar();
    scrollbarX.series.push(series1);
    scrollbarX.marginBottom = 20;
    var sbSeries = scrollbarX.scrollbarChart.series.getIndex(0);
    sbSeries.dataFields.valueYShow = undefined;
    chart.scrollbarX = scrollbarX;

}); // end am4core.ready()
<div class="card card-bordered">
    <div class="card-body">
        <div id="kt_amcharts_3" style="height: 500px;"></div>
    </div>
</div>

Explore Metronic

Metronic Licenses

License FAQs
Regular License
For single end product used by you or one client
$ 39
Extended License
For single end product with paying users.
$ 939
Custom License
Reach us for custom license offers.
Buy Now

Metronic Demos

demo
Coming soon
demo
Coming soon
demo
Coming soon
demo
Coming soon
demo
Coming soon
demo
Coming soon
demo
Coming soon
demo
Coming soon
demo
Coming soon