Convert Figma logo to code with AI

amcharts logoamcharts4

The most advanced amCharts charting library for JavaScript and TypeScript apps.

1,155
321
1,155
47

Top Related Projects

Highcharts JS, the JavaScript charting framework

64,568

Simple HTML5 Charts using the <canvas> tag

108,427

Bring data to life with SVG, Canvas and HTML. :bar_chart::chart_with_upwards_trend::tada:

16,856

Open-source JavaScript charting library behind Plotly and Dash

60,384

Apache ECharts is a powerful, interactive charting and data visualization library for browser

101,622

JavaScript 3D Library.

Quick Overview

amCharts 4 is a powerful JavaScript/TypeScript library for creating interactive and customizable charts and maps. It offers a wide range of chart types, from basic line and bar charts to complex hierarchical treemaps and network graphs, making it suitable for various data visualization needs.

Pros

  • Extensive chart types and customization options
  • Responsive and mobile-friendly designs
  • Excellent documentation and examples
  • Active development and community support

Cons

  • Steeper learning curve compared to simpler charting libraries
  • Large file size, which may impact page load times
  • Commercial license required for some features and removal of branding
  • Performance can be slower with large datasets

Code Examples

Creating a simple line chart:

// Create chart instance
let chart = am4core.create("chartdiv", am4charts.XYChart);

// Add data
chart.data = [{
  "date": "2021-01-01",
  "value": 100
}, {
  "date": "2021-01-02",
  "value": 120
}, {
  "date": "2021-01-03",
  "value": 110
}];

// Create axes
let dateAxis = chart.xAxes.push(new am4charts.DateAxis());
let valueAxis = chart.yAxes.push(new am4charts.ValueAxis());

// Create series
let series = chart.series.push(new am4charts.LineSeries());
series.dataFields.valueY = "value";
series.dataFields.dateX = "date";

Creating a pie chart:

// Create chart instance
let chart = am4core.create("chartdiv", am4charts.PieChart);

// Add data
chart.data = [{
  "category": "Category A",
  "value": 501.9
}, {
  "category": "Category B",
  "value": 301.9
}, {
  "category": "Category C",
  "value": 201.1
}];

// Add and configure Series
let pieSeries = chart.series.push(new am4charts.PieSeries());
pieSeries.dataFields.value = "value";
pieSeries.dataFields.category = "category";

Creating a map chart:

// Create map instance
let chart = am4core.create("chartdiv", am4maps.MapChart);

// Set map definition
chart.geodata = am4geodata_worldLow;

// Create map polygon series
let polygonSeries = chart.series.push(new am4maps.MapPolygonSeries());

// Make map load polygon (like country names) data from GeoJSON
polygonSeries.useGeodata = true;

// Configure series
let polygonTemplate = polygonSeries.mapPolygons.template;
polygonTemplate.tooltipText = "{name}";
polygonTemplate.fill = am4core.color("#74B266");

Getting Started

  1. Include amCharts 4 in your project:
<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>
  1. Create a div element to hold the chart:
<div id="chartdiv" style="width: 100%; height: 500px;"></div>
  1. Initialize and create your chart using JavaScript (see code examples above).

Competitor Comparisons

Highcharts JS, the JavaScript charting framework

Pros of Highcharts

  • More extensive documentation and examples
  • Larger community and ecosystem
  • Better performance with large datasets

Cons of Highcharts

  • Commercial license required for most use cases
  • Steeper learning curve for complex customizations
  • Larger file size, which may impact load times

Code Comparison

Highcharts:

Highcharts.chart('container', {
  series: [{
    data: [1, 2, 3, 4, 5]
  }]
});

amCharts 4:

am4core.ready(function() {
  let chart = am4core.create("chartdiv", am4charts.XYChart);
  chart.data = [{value: 1}, {value: 2}, {value: 3}, {value: 4}, {value: 5}];
});

Both libraries offer powerful charting capabilities, but they differ in their approach to initialization and data structure. Highcharts uses a more concise syntax, while amCharts 4 requires a bit more setup code.

Highcharts is generally considered more feature-rich and performant, especially for complex charts and large datasets. However, it comes with licensing costs for commercial use. amCharts 4, on the other hand, offers a free version with more permissive licensing terms, making it a popular choice for open-source projects and smaller applications.

The choice between these libraries often depends on specific project requirements, budget constraints, and the level of customization needed.

64,568

Simple HTML5 Charts using the <canvas> tag

Pros of Chart.js

  • Lightweight and simple to use, with a smaller learning curve
  • Free and open-source, suitable for both commercial and non-commercial projects
  • Responsive and mobile-friendly out of the box

Cons of Chart.js

  • Limited chart types and customization options compared to amCharts 4
  • Less powerful for complex data visualizations and interactive features
  • Smaller ecosystem and fewer plugins available

Code Comparison

Chart.js:

new Chart(ctx, {
    type: 'bar',
    data: {
        labels: ['Red', 'Blue', 'Yellow', 'Green', 'Purple', 'Orange'],
        datasets: [{
            label: '# of Votes',
            data: [12, 19, 3, 5, 2, 3]
        }]
    }
});

amCharts 4:

let chart = am4core.create("chartdiv", am4charts.XYChart);
chart.data = [{
    "country": "USA",
    "visits": 2025
}, {
    "country": "China",
    "visits": 1882
}];

Both libraries offer straightforward ways to create charts, but amCharts 4 provides more advanced features and customization options at the cost of a steeper learning curve and larger file size. Chart.js is ideal for simpler projects, while amCharts 4 excels in complex, interactive visualizations.

108,427

Bring data to life with SVG, Canvas and HTML. :bar_chart::chart_with_upwards_trend::tada:

Pros of d3

  • Highly flexible and customizable, allowing for complex and unique visualizations
  • Large and active community, resulting in extensive documentation and resources
  • Lightweight and modular, enabling users to include only necessary components

Cons of d3

  • Steeper learning curve, requiring more time and effort to master
  • Lower-level API, necessitating more code for basic charts and graphs
  • Less out-of-the-box functionality compared to amCharts 4

Code Comparison

d3:

const svg = d3.select("body").append("svg")
    .attr("width", 400)
    .attr("height", 300);

svg.selectAll("rect")
    .data(data)
    .enter()
    .append("rect")
    .attr("x", (d, i) => i * 40)
    .attr("y", d => 300 - d * 10)
    .attr("width", 35)
    .attr("height", d => d * 10);

amCharts 4:

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

let categoryAxis = chart.xAxes.push(new am4charts.CategoryAxis());
categoryAxis.dataFields.category = "category";

let valueAxis = chart.yAxes.push(new am4charts.ValueAxis());

let series = chart.series.push(new am4charts.ColumnSeries());
series.dataFields.valueY = "value";
series.dataFields.categoryX = "category";
16,856

Open-source JavaScript charting library behind Plotly and Dash

Pros of plotly.js

  • More extensive documentation and examples
  • Larger community and ecosystem
  • Better support for scientific and statistical visualizations

Cons of plotly.js

  • Steeper learning curve for complex visualizations
  • Larger file size, which may impact page load times
  • Less customizable styling options for some chart types

Code Comparison

plotly.js:

Plotly.newPlot('myDiv', [{
  x: [1, 2, 3, 4],
  y: [10, 15, 13, 17],
  type: 'scatter'
}]);

amCharts 4:

let chart = am4core.create("chartdiv", am4charts.XYChart);
chart.data = [{
  x: 1,
  y: 10
}, {
  x: 2,
  y: 15
}, {
  x: 3,
  y: 13
}, {
  x: 4,
  y: 17
}];

Both libraries offer powerful charting capabilities, but they differ in their approach and focus. plotly.js excels in scientific and statistical visualizations, while amCharts 4 provides more flexibility in design and animation. The code comparison shows that plotly.js has a more concise syntax for basic charts, while amCharts 4 requires more setup but offers greater control over chart elements.

60,384

Apache ECharts is a powerful, interactive charting and data visualization library for browser

Pros of ECharts

  • Open-source and free to use, with no licensing restrictions
  • Extensive documentation and community support
  • Supports a wide range of chart types and customization options

Cons of ECharts

  • Steeper learning curve for complex visualizations
  • Larger file size compared to AmCharts 4

Code Comparison

ECharts:

option = {
  xAxis: {
    type: 'category',
    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
  },
  yAxis: {
    type: 'value'
  },
  series: [{
    data: [120, 200, 150, 80, 70, 110, 130],
    type: 'bar'
  }]
};

AmCharts 4:

let chart = am4core.create("chartdiv", am4charts.XYChart);
chart.data = [{
  "day": "Mon",
  "value": 120
}, {
  "day": "Tue",
  "value": 200
}];
let categoryAxis = chart.xAxes.push(new am4charts.CategoryAxis());
categoryAxis.dataFields.category = "day";
let valueAxis = chart.yAxes.push(new am4charts.ValueAxis());
let series = chart.series.push(new am4charts.ColumnSeries());
series.dataFields.valueY = "value";
series.dataFields.categoryX = "day";

Both libraries offer powerful charting capabilities, but ECharts provides more flexibility and options for advanced visualizations, while AmCharts 4 may be easier to get started with for simpler charts.

101,622

JavaScript 3D Library.

Pros of three.js

  • Powerful 3D rendering capabilities for complex visualizations
  • Large, active community with extensive documentation and examples
  • Versatile, supporting various 3D use cases beyond data visualization

Cons of three.js

  • Steeper learning curve for beginners compared to AmCharts 4
  • Requires more custom coding for basic chart types
  • Less focused on traditional data visualization and charting

Code Comparison

three.js (3D scene setup):

const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
const renderer = new THREE.WebGLRenderer();
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);

AmCharts 4 (basic chart setup):

let chart = am4core.create("chartdiv", am4charts.XYChart);
chart.data = [{
  "country": "USA",
  "visits": 2025
}, {
  "country": "China",
  "visits": 1882
}];

The code comparison illustrates the different focus of each library. three.js requires more setup for a basic 3D scene, while AmCharts 4 provides a simpler API for creating standard charts. three.js offers more flexibility for custom 3D visualizations, whereas AmCharts 4 is optimized for common chart types and data visualization tasks.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

amCharts 4

This is an official repository for amCharts 4 - the most advanced JavaScript dataviz library ever.

For a short overview of features, visit this page.

Contents

DirectoryDescription
/dist/ember/Official Ember plugin for amCharts 4
/dist/es2015/Compiled ES2015 modules
/dist/script/Compiled standalone JavaScript files
/src/TypeScript sources for amCharts 4

Documentation

For extensive documentation, including getting started tutorials, as well as class reference visit V4 documentation website.

Other ways to get amCharts 4

Related packages

This package inlcudes MapChart (geographical maps) functionality. However, it does not include geodata itself (map files) needed to instantiate the maps.

Those are available via separate package:

License

If you have a commercial amCharts 4 license, this software is covered by your license, which supersedes any other license bundled with this package.

If you don't have a commercial license, the use of this software is covered by a freeware license. Refer to included LICENSE file. The license is also available online.

Changelog

Questions?

Contact amCharts.

Found a bug?

Open an issue.

How to build

Run yarn install and then yarn run build. The compiled code will be in the dist folder.

NPM DownloadsLast 30 Days