ri.set("start", 10);
ri.set("value", 40);
ri.set("radius", 60);
this.gauge.getElement("scale").addIndicator("ri", ri, false);
Multiple ranges can be added as desired.
The CircularRangeIndicator contains a number of properties including:
• start – The start value of the range indicator.
• value – The end value of the range indicator
• radius – The outer position of the range indicator in pixels.
• startThickness – The start thickness of the indicator in pixels. Thickness moves the
donut circle towards the center.
• endThickness – The end thickness of the indicator in pixels
• fill – A GFX fill object that is passed to the setFill() method of GFX. For example,
an RGB color value such as "#443322".
• stroke – A GFX stroke object that is passed to the setStroke() method of GFX.
A CircularValueIndicator contains a number of properties including:
• value – The position of the indicator.
It also has a callback function called "indicatorShapeFunc" which is called to draw the
indicator at the value. It is passed two parameters which are:
• group – The GFX group
• indicator – The indicator object
The default indicator is a simple line:
To create our own indicator style, we use the GFX "group" parameter to draw our own shape
complete with fill and stroke. Experimentation shows that we should use a virtual coordinate
system with the following concepts:
• The origin is at 0,0 and will be the center of the gauge.
• The positive X-Axis is "outwards" from the origin towards the indicator value.
The following is an example of a custom indicator:
vi.indicatorShapeFunc = function(group, indicator) {
return group.createPolyline([50, -1, 62, -1, 62, 1, 50, 1, 50, -1]).setStroke({
color: "blue",
width: 0.25
}).setFill([100, 100, 255, 1]);
};
Page 217
Kommentare zu diesen Handbüchern