| 1 |
define(["dojo/_base/declare","./_Indicator"], |
| 2 |
function(declare, Indicator) { |
| 3 |
|
| 4 |
return declare("dojox.gauges.TextIndicator", [Indicator], { |
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
x: 0, |
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
y: 0, |
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
align: 'middle', |
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
fixedPrecision: true, |
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
precision: 0, |
| 28 |
|
| 29 |
draw: function(group, dontAnimate){ |
| 30 |
|
| 31 |
|
| 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 |
}); |