dojox/dgauges/LogScaler (version 1.10)

dojo/Stateful

Summary

The LogScaler maps numeric values evenly between a minimum and a maximum value along a gauge scale. If no multiplier is specified, the scale will place a tick on each power of 10 value (1, 10, 100, 1000, and so on) between the minimum and maximum values.

Usage

var foo = new LogScaler();
dojox/dgauges/LogScaler

See the dojox/dgauges/LogScaler reference documentation for more information.

Property Summary

Method Summary

Properties

_attrPairNames
Defined by: dojo/Stateful

Used across all instances a hash to cache attribute names and their getter and setter names.

_computedMultiplier
majorTicks

The array of generated major ticks. You should not set this property when using the scaler.

maximum

The maximum value of the scaler. Default is 1000.

minimum

The minimum value of the scaler. Default is 0.

multiplier

The interval between two major ticks.

Methods

_buildMajorTickItems()

Internal method.

Returns:Array
_changeAttrValue(name,value)
Defined by dojo/Stateful

Internal helper for directly changing an attribute value.

Directly change the value of an attribute on an object, bypassing any accessor setter. Also handles the calling of watch and emitting events. It is designed to be used by descendant class when there are two values of attributes that are linked, but calling .set() is not appropriate.

Parameter Type Description
name String

The property to set.

value Mixed

The value to set in the property.

Returns:function

Internal helper for directly changing an attribute value.

_get(name,names)
Defined by dojo/Stateful

Private function that does a get based off a hash of names

Parameter Type Description
name undefined
names undefined

Hash of names of custom attributes

Returns:undefined
_getAttrNames(name)
Defined by dojo/Stateful

Helper function for get() and set(). Caches attribute name values so we don't do the string ops every time.

Parameter Type Description
name undefined
Returns:undefined | object
computeTicks()

Creates or re-creates the ticks for this scaler.

Returns:Array | undefined

An array containing ticks.

get(name)
Defined by dojo/Stateful

Get a property on a Stateful instance.

Get a named property on a Stateful object. The property may potentially be retrieved via a getter method in subclasses. In the base class this just retrieves the object's property.

Parameter Type Description
name String

The property to get.

Returns:any | undefined

The property value on this Stateful instance.

Examples

Example 1

require(["dojo/Stateful", function(Stateful) {
    var stateful = new Stateful({foo: 3});
    stateful.get("foo") // returns 3
    stateful.foo // returns 3
});
getComputedMaximum()

The computed maximum value of the scale. If the maximum value is not an even power of 10, the scale computes a new maximum so that it maps to an even power of 10.

Returns:undefined
getComputedMinimum()

The computed minimum value of the scale. If the minimum value is not an even power of 10, the scale computes a new minimum so that it maps to an even power of 10.

Returns:undefined
getComputedMultiplier()

The computed multiplier value of the scale. If the multiplier value is not an even power of 10, the scale computes a new multiplier so that it maps to an even power of 10.

Returns:undefined
positionForValue(value)

Transforms a value into a relative position between 0 and 1.

Parameter Type Description
value Number

A value to transform.

Returns:Number | number

The position between 0 and 1.

postscript(params)
Defined by dojo/Stateful
Parameter Type Description
params Object
Optional
set(name,value)
Defined by dojo/Stateful

Set a property on a Stateful instance

Sets named properties on a stateful object and notifies any watchers of the property. A programmatic setter may be defined in subclasses.

Parameter Type Description
name String

The property to set.

value Object

The value to set in the property.

Returns:any | function

The function returns this dojo.Stateful instance.

Examples

Example 1

require(["dojo/Stateful", function(Stateful) {
    var stateful = new Stateful();
    stateful.watch(function(name, oldValue, value){
        // this will be called on the set below
    }
    stateful.set(foo, 5);

set() may also be called with a hash of name/value pairs, ex:

stateful.set({
    foo: "Howdy",
    bar: 3
});
});

This is equivalent to calling set(foo, "Howdy") and set(bar, 3)

valueForPosition(position)

Transforms a relative position (between 0 and 1) into a value.

Parameter Type Description
position Number

A relative position to transform.

Returns:Number | undefined

The transformed value between minimum and maximum.

watch(name,callback)
Defined by dojo/Stateful

Watches a property for changes

Parameter Type Description
name String
Optional

Indicates the property to watch. This is optional (the callback may be the only parameter), and if omitted, all the properties will be watched

callback Function

The function to execute when the property changes. This will be called after the property has been changed. The callback will be called with the |this| set to the instance, the first argument as the name of the property, the second argument as the old value and the third argument as the new value.

Returns:any | object

An object handle for the watch. The unwatch method of this object can be used to discontinue watching this property:

var watchHandle = obj.watch("foo", callback);
watchHandle.unwatch(); // callback won't be called now
Error in the documentation? Can’t find what you are looking for? Let us know!