Class: Axis

Axis

A map axis object that will attach to a map edge and display coordinates based on supplied interval and unit specification.

new Axis(spec)

Instantiate an Axis object.
Name Type Description
spec Object The specification object:
{
    position {String}  Set the position to the bottom of the map. Default = "bottom"
    title    {String}  Set the title of the axis label. Default = "Axis"
    enabled  {boolean} Have the axis initialize to an open or closed state. Default = true
    repeat   {boolean} Whether or not the axis repeats. Default = false
    intervals: {
        type          {String}  Whether the intervals are by "percentage" or by "value". Default = "percentage"
        increment     {number}  The interval increment in. Default = 10
        pivot         {number}  The value from with increments are generated from. Default = undefined
        scaleByZoom   {boolean} Whether the increments should be scaled by zoom level. Default = true
        minPixelWidth {number}  The minimum width for a full axis increment. Default = undefined;
    }
    units: {
        type     {String}  The type of unit, ["integer", "decimal", "thousands", "millions", "billions", "degrees"]. Default = "decimal"
        decimals {number}  The number of decimals to display, if applicable. Default = 2
        stepDown {boolean} Whether values should step down by unit type, if applicable. Default = true
    }
}

Methods

getChannel(){String}

Returns the publish/subscribe channel id of this specific axis.
Returns:
publish/subscribe channel for the axis.

getContentDimension(){integer}

Returns the dimension of the content div of the axis.
Returns:
dimension of the content div.

getMaxContentDimension(){integer}

Iterates over all axes on the map, determines the max content size, and sets the content dimension to that size.
Returns:
max dimension of the axes attached to the map.

isEnabled(){boolean}

Returns true if the axis is currently enabled, false if not.
Returns:
or not the axis is enabled or not.

redraw()

Checks if the mutable spec attributes have changed, if so, redraws the axis.

setEnabled(enabled)

Enable or disable the axis.
Name Type Description
enabled boolean Whether to enable or disable the axis.

updateDimension()

Sets the content dimension of the axis.