getDataSource(id: String);
id. Data source ID.
The getDataSource method returns data source by its ID.
The method returns value of the PP.DataSource type.
To execute the example the HTML page must contain the MapChart component named map (see Example of Creating the MapChart Component). Determine name and data for the region with the RU-PER identifier:
// Get data source var dataSource = map.getDataSource("DataSource0"); // Get data series var series = dataSource.getSeries(); // Get data of the RU-PER series var serie = series["RU-PER"].getItems(); console.log("Data of the RU-PER series: " + serie.toString()); // Get the name of the region with the RU-PER ID var region = map.getRegionName("RU-PER"); console.log("Name of the RU-PER region: " + region);
After executing the example the browser console displays name and data for the region with the RU-PER ID:
Data of the RU-PER series: 81.1487794300303,44.9419735208815,4.75851106678998,72.7369993798141
Name of the RU-PER region: Perm
See also: