In addition to the value and range indicators, we also have the notion of a text indicator. This is
responsible for showing a piece of text in the gauge. This can be static or dynamically updated
based on the value or range. Like the other components, a TextIndicator can be added to a gauge
using the addElement() method.
Among the properties of the TextIndicator are:
• value - The text to be shown to the user.
• align – How the text is aligned. Options are:
◦ start
◦ middle
◦ end
• color – The color of the text.
• font – The font of the text.
• labelFunc – A function used to determine the value of the text.
• x – The "x" origin.
• y – The "y" origin.
Sample custom circular guage
We base our new widget upon dojox/dguages/CircularGuage.
Next we add elements to our gauge which can be CircularScale, TextIndicator or a drawing
function.
Sample custom rectangular guage
We base our new widget upon dojox/dguages/RectangularGuage.
Dojo GFX
GFX is a vector drawing package for Dojo.
The surface is the primary drawing area. Its size is defined when created but can later be changed
with the setDimensions(width, height) method.
Method Properties
createRect
x, y, width, height, r
createCircle
cx, cy, r
createEllipse
cx, cy, rx, ry
createLine
x1,y1,x2,y2
createPolyline
points
createPath
path
createImage
x, y, width, height, src
createText
x, y, text, align, decoration, rotated, kerning
createTextPath
path, text, align, decoration, rotated kerning
Page 218
Kommentare zu diesen Handbüchern