getMappingById(id: Number);
id. Identifier of data mapping settings.
The getMappingById method returns data mapping settings by its identifier.
The method returns an object of the PP.DataMapping type.
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 name and data source for the object of data mapping with bubble chart bubbles color, also get data mapping settings and determine identifier and name of the dimension attribute:
// Get object of mapping of data series and bubble chart bubble colors var colorVisual = bubbleChart.getColorVisual(); // Set mapping name colorVisual.setName("colorVisual"); // Set data source colorVisual.setDataSource(bubbleChart.getDataSources().ds0); // Get data mapping name console.log("Data mapping name: " + colorVisual.getName()); // Get identifier of mapping settings var mappingId = colorVisual.getColorMapping().getId(); var mapping = colorVisual.getMappingById(mappingId); // Get identifier of dimension attribute 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 the following information: name of data mapping object, identifier and name of the dimension attribute that corresponds to data mapping with bubble chart bubble color:
Data mapping name: colorVisual
Dimension attribute identifier: DimCol
Dimension attribute name: Gross regional product per capita, rubles
See also: