DataLoader
Type class
Data Loader is responsible for loading and parsing external data.
There is just one instance of DataLoader per system. Unless you have a speicific reason, do not instantiate additional instances.
The global instance of Data Loader is accessible via:
am4core.dataLoader;
am4core.dataLoader;
A loading of specific data source is done via DataSource.
Please refer to DataSource for information how to use it.
More info: IDataLoaderAdapters for a list of available Adapters
Sources
DataLoader can be used (imported) via one of the following packages.
/** * Import from: "core.ts" * Use like: am4core.DataLoader */import * as am4core from "@amcharts/amcharts4/core";/** * Include via: <script src="core.js"></script> * Access items like: am4core.DataLoader */Inheritance
DataLoader does not extend any other symbol.
DataLoader is not extended by any other symbol.
Properties
adapterType
Adapter<DataLoader,IDataLoaderAdapters>Defaultnew Adapter<DataLoader, IDataLoaderAdapters>(this)Adapter.
Methods
getParserByData(data:string,
contentType?:string)Returns
DataParserTries to determine a parser out of content type and/or actual data.
getParserByType(contentType:string)Returns
DataParserInstantiates a
DataParserobject based on the data type.Built-in parser types are as follows:
"csv" or "text/csv"
"json" or "application/json"
load(source:DataSource|DataSource[])Returns
voidLoads a supplied
DataSourceor an array of data sources, then calls their respectiveparsemethods.
Events
DataLoader does not have any events.
Adapters
getParserByDataParam { data:
string, parser:DataParser, type:string}Applied after the Data Loader determines suitable parser type based on its data examination.
getParserByTypeParam { parser:
DataParser, type:string}Applied after the Data Loader determines suitable parser type by data source's URL extension.