dojox/dgauges/TextIndicator (version 1.9)

dojox/dgauges/IndicatorBase

This type of indicator is used to render text. To render an arbitrary text, set the value property. To render the value of a value indicator or a range indicator, set the indicator property. Setting the indicator property takes precedence on setting the value property. When the indicator property is set, the text is automatically updated on value changes.

Usage:

var foo = new TextIndicator();
Defined by dojox/dgauges/TextIndicator

Property Summary

Method Summary

  • _changeAttrValue(name, value) Internal helper for directly changing an attribute value.
  • _createText(group, font, color, text, x, y, align) Internal method.
  • _get(name, names) Private function that does a get based off a hash of names
  • _getAttrNames(name) Helper function for get() and set().
  • _getFont() Internal method.
  • _indicatorChanged(name, oldValue, newValue) Internal method.
  • _resetText() Internal method.
  • addInvalidatingProperties(properties) Add properties to the watched properties to trigger invalidation.
  • get(name) Get a property on a Stateful instance.
  • invalidateRendering() Invalidating the rendering for the next executation frame.
  • postscript(mixin) Internal method
  • refreshRendering()
  • set(name, value) Set a property on a Stateful instance
  • validateRendering() Immediately validate the rendering if it has been invalidated.
  • watch(name, callback) Watches a property for changes

Properties

_attrPairNames
Defined by dojo/Stateful

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

_textCreated
_textInstance
_valueWatcher
align

An alignment of a text in regards to the anchor position:

  • "start": A text's baseline starts at the anchor. This is the default value of the align attribute.
  • "middle": A text's baseline is centered on the anchor point.
  • "end": A text's baseline ends at the anchor point.
color

The color of the text.

font

Font used by this element.

indicator

If this property is set, the value of the indicator is automatically rendered by this text element.

invalidatingProperties
invalidRendering
labelFunc

If set, this method allows to format the value of this text indicator. A label function takes the text to render as argument and returns a String.

value

The value of this indicator.

x

The text anchor x-position. Default is 0.

y

The text anchor y-position. Default is 0.

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 descendent class when there are two values of attributes that are linked, but calling .set() is not appropriate.

ParameterTypeDescription
nameString

The property to set.

valueMixed

The value to set in the property.

Returns: function

Internal helper for directly changing an attribute value.

_createText(group, font, color, text, x, y, align)

Internal method.

ParameterTypeDescription
groupundefined
fontundefined
colorundefined
textundefined
xundefined
yundefined
alignundefined
Returns: undefined
_get(name, names)
Defined by dojo/Stateful

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

ParameterTypeDescription
nameundefined
namesundefined

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.

ParameterTypeDescription
nameundefined
Returns: undefined | object
_getFont()

Internal method.

Returns: object

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

_indicatorChanged(name, oldValue, newValue)

Internal method.

ParameterTypeDescription
nameundefined
oldValueundefined
newValueundefined
_resetText()

Internal method.

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.

ParameterTypeDescription
propertiesString[]

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. For example:

stateful = new dojo.Stateful({foo: 3});
stateful.get("foo") // returns 3
stateful.foo // returns 3
ParameterTypeDescription
nameString

The property to get.

Returns: any | undefined

The property value on this Stateful instance.

invalidateRendering()

Invalidating the rendering for the next executation frame.

postscript(mixin)

Internal method

ParameterTypeDescription
mixinundefined
refreshRendering()
Returns: undefined
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. For example:

stateful = new dojo.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:

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

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

ParameterTypeDescription
nameString

The property to set.

valueObject

The value to set in the property.

Returns: any | function

The function returns this dojo.Stateful instance.

validateRendering()

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

watch(name, callback)
Defined by dojo/Stateful

Watches a property for changes

ParameterTypeDescription
nameString
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

callbackFunction

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