ScaleBase.RoundBias

Syntax

RoundBias: Number;

Description

The RoundBias property determines maximum available values of difference between scale source value and rounded scale value.

Comments

Use JSON or the setRoundBias method to set the property value and the getRoundBias method to get the property value.

The property value is calculated as a percent to the difference between values of the ScaleBase.MaxValue and ScaleBase.MinValue properties.

If the property value is in the range from 0 to 1, the scale value will be rounded down or up, respectively.

Example

Executing the example requires that the HTML page contains the MapChart (see Placing of Map on HTML Page) named map, XML file with settings of map and the Russia.svg topobase.

The XML file must contain settings of the fill factor that is the first located in the list of map factors. Fill background - dependency object, for which scale is set up that contains values of the Brush. The XML file must also have legend set up with the MapLegend0 identifier.

Create an array of data and calculate scale intervals based on this array.

// Create a data array
data = [0.01, 2, 3, 4, 5, 6, 7, 8, 9, 99.22];
// Determine the number of elements
var count = data.length;
var scale = map.getFirstVisual().getColorMapping().getScale();
// Determine and set minimum value
var min = 0;
scale.setMinValue(min);
// Determine and set maximum value
var max = 99.3;
scale.setMaxValue(max);
scale.setMode("Uniform");// select splitting into intervals in the Equal mode
scale.setRecalcValues(true); //recalculate collection of scale values
scale.setRoundBias(1); // set rounding up of values
// Plot scale by new data 
scale.constructScaleElements(data); 
legend = map.getLegends().FirstLegend;
// Draw legend
legend.draw();

After executing the example legend scale values are rounded up.

See also:

ScaleBase