DataMapping.DataSource

Syntax

DataSource: PP.DataSource;

Description

The DataSource property specifies data source for object of data mapping settings.

Comments

Property value can be set from JSON or using the setDataSource method.

Example

To execute the example, the HTML page must contain the component named bubbleChart (see Example of Creating the BubbleChart ComponentBubbleChart component named bubbleChart (see Example of Creating the BubbleChart Component). Set a new dimension attribute ID and data source for the object that contains settings of data mapping with colors of bubble chart bubbles, and also get dimension attribute name:

// Get object of mapping of series data with bubble colors 
var colorVisual = bubbleChart.getColorVisual();
// Set data source
colorVisual.setDataSource(bubbleChart.getDataSources().ds0);
// Get data mapping settings
var mapping = colorVisual.getColorMapping();
// Set dimension attribute identifier
mapping.setDimAttributeId("DimR");
// Get dimension attribute identifier
console.log("Dimension attribute identifier: " + mapping.getDimAttributeId());
// Get dimension attribute name
var dimName = colorVisual.getDataSource().getAttributesNames()[mapping.getDimAttributeId()];
console.log("Dimension attribute name: «" + dimName + "»");

After executing the example the browser console displays new identifier and name of the dimension attribute that corresponds to data mapping with bubble chart bubbles color:

Dimension attribute identifier: DimR

Dimension attribute name: Gross regional product per capita, rubles

See also:

DataMapping