Debian Codegraph @

dojox/gauges/TextIndicator.js

raw symbols SCIP
1 define(["dojo/_base/declare","./_Indicator"],
2 function(declare, Indicator) {
3
4 return declare("dojox.gauges.TextIndicator", [Indicator], {
5 // summary:
6 // A gauge indicator the simply draws its value as text.
7
8
9 // x: Number
10 // The x coordinate of the indicator
11 x: 0,
12
13 // y: Number
14 // The y coordinate of the indicator
15 y: 0,
16
17 // align: String
18 // The horizontal alignment of the text, the value can be 'middle' (the default), 'left' or 'right'
19 align: 'middle',
20
21 // fixedPrecision: Boolean
22 // Indicates that the number is displayed in fixed precision or not (precision is defined by the 'precision' property (default is true).
23 fixedPrecision: true,
24
25 // precision: Number
26 // The number of tailing digits to display the value of the indicator when the 'fixedPrecision' property is set to true (default is 0).
27 precision: 0,
28
29 draw: function(group, /*Boolean?*/ dontAnimate){
30 // summary:
31 // Override of dojox.gauges._Indicator.draw
32 var v = this.value;
33
34 if (v < this._gauge.min) {
35 v = this._gauge.min;
36 }
37 if (v > this._gauge.max) {
38 v = this._gauge.max;
39 }
40 var txt;
41 var NumberUtils = this._gauge ? this._gauge._getNumberModule() : null;
42 if (NumberUtils) {
43 txt = this.fixedPrecision ? NumberUtils.format(v, {
44 places: this.precision
45 }) : NumberUtils.format(v);
46 } else {
47 txt = this.fixedPrecision ? v.toFixed(this.precision) : v.toString();
48 }
49
50 var x = this.x ? this.x : 0;
51 var y = this.y ? this.y : 0;
52 var align = this.align ? this.align : "middle";
53 if(!this.shape){
54 this.shape = group.createText({
55 x: x,
56 y: y,
57 text: txt,
58 align: align
59 });
60 }else{
61 this.shape.setShape({
62 x: x,
63 y: y,
64 text: txt,
65 align: align
66 });
67 }
68 this.shape.setFill(this.color);
69 if (this.font) this.shape.setFont(this.font);
70
71 }
72
73 });
74 });