ScaleBase.equal

Syntax

equal (index, isInactiveItem);

Parameters

index. Scale item index.

isInactiveItem. Determines whether to use a data collection for highlighting.

Description

The equal method returns scale item for a value equal to the value that corresponds to specified index.

Example

To execute the example, the HTML page must contain the MapChart component (see Placing of Map on a 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 type.

Create a value editor for scale item index selection and a button to get colors that correspond to values equal, greater than or less that the value that corresponds to specified index:

 scale = map.getFirstVisual().getBackground().getMapScale();

 var numb = new PP.Ui.NumberEdit({

     ParentNode: document.body,

     MinValue: 0,

     MaxValue: scale.getCount(),//Maximum editor value: number of scale items

     Width: 50

 })

 value = numb.getValue();

 var but = new PP.Ui.Button({

     ParentNode: document.body,

     Content: "Get colors by index",

     Click: function (sender, args) {

         console.log("Less than color: " + scale.less(value).getColor() + " Greater than color: " + scale.greater(value).getColor() + " Equal color: " + scale.equal(value).getColor())

     }

 });

After executing the example a value editor and the Get Colors by Index button are placed in the page. On clicking this button the browser console displays HTML colors that correspond to values equal to, greater than and smaller than the value selected in value editor.

See also:

ScaleBase