| 1 |
define(["dojo/_base/declare","./AnalogIndicatorBase"], |
| 2 |
function(declare, AnalogIndicatorBase) { |
| 3 |
|
| 4 |
return declare("dojox.gauges.AnalogNeedleIndicator", [AnalogIndicatorBase], { |
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
_getShapes: function(group){ |
| 10 |
|
| 11 |
|
| 12 |
if(!this._gauge){ |
| 13 |
return null; |
| 14 |
} |
| 15 |
var x = Math.floor(this.width/2); |
| 16 |
var shapes = []; |
| 17 |
|
| 18 |
var color = this.color ? this.color : 'black'; |
| 19 |
var strokeColor = this.strokeColor ? this.strokeColor : color; |
| 20 |
var strokeWidth = this.strokeWidth ? this.strokeWidth : 1; |
| 21 |
|
| 22 |
var stroke = { |
| 23 |
color: strokeColor, |
| 24 |
width: strokeWidth |
| 25 |
}; |
| 26 |
|
| 27 |
if (color.type && !this.strokeColor){ |
| 28 |
stroke.color = color.colors[0].color; |
| 29 |
} |
| 30 |
|
| 31 |
var xy = (Math.sqrt(2) * (x)); |
| 32 |
shapes[0] = group.createPath() |
| 33 |
.setStroke(stroke).setFill(color) |
| 34 |
.moveTo(xy, -xy).arcTo((2*x), (2*x), 0, 0, 0, -xy, -xy) |
| 35 |
.lineTo(0, -this.length).closePath(); |
| 36 |
shapes[1] = group.createCircle({cx: 0, cy: 0, r: this.width}) |
| 37 |
.setStroke(stroke) |
| 38 |
.setFill(color); |
| 39 |
return shapes; |
| 40 |
} |
| 41 |
}); |
| 42 |
}); |