Loading CSV File

Overview

Ability to load CSV files is one of the things Data Adapter provides.

To work with the features Data Adapter provides you need to plug it in along with AnyChart Library:

<!-- Include the data adapter -->
<script src="https://cdn.anychart.com/js/latest/data-adapter.min.js"></script>

You can load Data from CSV into AnyChart without the help of Data Adapter but if you want to load a file you can do it using the data adapter and the loadCsvFile() method as described below.

loadCsvFile method

Using loadCsvFile() method is as easy as this:

anychart.data.loadCsvFile("https://cdn.anychart.com/charts-data/data_csv.csv", function (data) {
	// create chart from loaded data
	chart = anychart.bar(data);
	// set title
	chart.title("AnyChart from CSV File");
	// draw chart
	chart.container("container").draw();
});

Here is a live sample:

Playground

This method also allows to handle loading errors, changing sending method, adding headers, setting timeout interval, and sending credentials, see all available parameters in loadCsvFile() API description.

CSV Settings

To learn about availale CSV Data settings please refer to the Data from CSV article.

You are looking at an outdated v7 version of this document. Switch to the v8 version to see the up to date information.