findValueFormat(text: String);
text. Format of the label for map legend intervals, from which you need to get values formats.
The findValueFormat method converts format of map legend interval label to array of value formats.
The method returns an array of String values.
To execute the example the HTML page must contain the MapChart component named map (see Example of Creating the MapChart Component). Format the source value in accordance with format of the label for the map legend interval with both borders (take value for the left border):
// Set the source value var sourceValue = 12.6784; console.log("Source value: " + sourceValue); // Get the first legend var legend = map.getFirstLegend(); // Get format for the label of intervals with both borders var betweenFormat = legend.getBetweenFormat(); // Extract values format valueFormats = map.findValueFormat(betweenFormat); // Format the source value using the first format var value = map.formatValue(sourceValue, valueFormats[0]); console.log("Formatted value: " + value);
After executing the example the value 12.6784 was formatted in accordance with the format of the label for the map legend interval with both borders (value for the left border is used):
Initial value: 12.6784
Formatted value: 12,68
See also: