dojox/dgauges/RectangularScale (version 1.10)

dojox/dgauges/ScaleBase

Summary

The rectangular scale. A scaler must be set to use this class.

Usage

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

See the dojox/dgauges/RectangularScale 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.

_bgGroup
_contentBox
_fgGroup
_gauge
_gfxGroup
_indicators
_indicatorsIndex
_indicatorsRenderers
_watchers
font

The font used for the ticks labels. This is null by default which means this scale use the font defined on the gauge.

invalidatingProperties
invalidRendering
labelGap

The label gap between the ticks and their labels. Default value is 1.

labelPosition

See CircularScale and RectangularScale for valid values.

paddingBottom

The bottom padding.

paddingLeft

The left padding.

paddingRight

The right padding.

paddingTop

The top padding.

scaler

The scaler used for tick generation and data-transform operations. This property is mandatory for using the scale.

tickStroke

The GFX stroke used by the default tickShapeFunc implementation.

Methods

_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.

_createSubGroups()

Internal method.

_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
_getFont()

Internal method.

Returns:object

An object specifying the default properties for a Font used in text operations.

_watchScaler(name,oldValue,newValue)

Internal method.

Parameter Type Description
name undefined
oldValue undefined
newValue undefined
addIndicator(name,indicator,behindScale)

Add an indicator to the scale. Before calling this function, ensure this scale has already been added to a gauge using the addElement method of the gauge.

Parameter Type Description
name String

The name of the indicator to be added.

indicator dojox/dgauges/IndicatorBase

The indicator to add to this scale.

behindScale Boolean

If true, this indicator is drawn behind the scale. Default value is false.

Returns:undefined
addInvalidatingProperties(properties)

Add properties to the watched properties to trigger invalidation. This method must be called in the constructor. It is typically used by subclasses of a _Invalidating class to add more properties to watch for.

Parameter Type Description
properties String[]

The list of properties to watch for.

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
});
getIndicator(name)

Get an indicator instance.

Parameter Type Description
name String

The name of the indicator as defined using addIndicator.

Returns:IndicatorBase | undefined

The indicator associated with the name parameter.

getIndicatorRenderer(name)

Gets the GFX shape of an indicator.

Parameter Type Description
name String

The name of the indicator as defined using addIndicator.

Returns:dojox/gfx/canvas/Shape | undefined

The GFX shape of the indicator.

invalidateRendering()

Invalidating the rendering for the next executation frame.

positionForValue(value)

Transforms a value into a position using the associated scaler.

Parameter Type Description
value undefined

The value to transform.

Returns:Number | number

A position in pixels.

postscript(mixin)

Internal method.

Parameter Type Description
mixin undefined
refreshRendering()
removeIndicator(name)

Removes an indicator.

Parameter Type Description
name String

The name of the indicator as defined using addIndicator.

Returns:IndicatorBase | undefined

The removed indicator.

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)

tickLabelFunc(tickItem)

Customize the text of ticks labels.

Parameter Type Description
tickItem Object

An object containing the tick informations.

Returns:String | null | undefined

The text to be aligned with the tick. If null, the tick has no label.

tickShapeFunc(group,scale,tickItem)

Customize the shape of ticks.

Parameter Type Description
group dojox/gfx/Group

The GFX group used for drawing the tick.

scale dojox/dgauges/ScaleBase

The scale being processed.

tickItem Object

An object containing the tick informations.

Returns:undefined
validateRendering()

Immediately validate the rendering if it has been invalidated. You generally do not call that method yourself.

valueForPosition(pos)

Transforms a position in pixels into a value using the associated scaler.

Parameter Type Description
pos undefined

The position to transform.

Returns:Number | undefined

The value represented by pos.

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!