1 | define(["dojo/_base/declare","./AnalogIndicatorBase"], |
---|
2 | function(declare, AnalogIndicatorBase) { |
---|
3 | |
---|
4 | return declare("dojox.gauges.AnalogArrowIndicator", [AnalogIndicatorBase],{ |
---|
5 | |
---|
6 | // summary: |
---|
7 | // An indicator for the AnalogGauge that draws an arrow. The arrow is drawn on the angle that corresponds |
---|
8 | // to the value of the indicator. |
---|
9 | |
---|
10 | _getShapes: function(group){ |
---|
11 | // summary: |
---|
12 | // Override of dojox.gauges.AnalogLineIndicator._getShapes |
---|
13 | if(!this._gauge){ |
---|
14 | return null; |
---|
15 | } |
---|
16 | var color = this.color ? this.color : 'black'; |
---|
17 | var strokeColor = this.strokeColor ? this.strokeColor : color; |
---|
18 | var stroke = { color: strokeColor, width: 1}; |
---|
19 | if (this.color.type && !this.strokeColor){ |
---|
20 | stroke.color = this.color.colors[0].color; |
---|
21 | } |
---|
22 | |
---|
23 | var x = Math.floor(this.width/2); |
---|
24 | var head = this.width * 5; |
---|
25 | var odd = (this.width & 1); |
---|
26 | var shapes = []; |
---|
27 | var points = [{x:-x, y:0}, |
---|
28 | {x:-x, y:-this.length+head}, |
---|
29 | {x:-2*x, y:-this.length+head}, |
---|
30 | {x:0, y:-this.length}, |
---|
31 | {x:2*x+odd,y:-this.length+head}, |
---|
32 | {x:x+odd, y:-this.length+head}, |
---|
33 | {x:x+odd, y:0}, |
---|
34 | {x:-x, y:0}]; |
---|
35 | shapes[0] = group.createPolyline(points) |
---|
36 | .setStroke(stroke) |
---|
37 | .setFill(color); |
---|
38 | shapes[1] = group.createLine({ x1:-x, y1: 0, x2: -x, y2:-this.length+head }) |
---|
39 | .setStroke({color: this.highlight}); |
---|
40 | shapes[2] = group.createLine({ x1:-x-3, y1: -this.length+head, x2: 0, y2:-this.length }) |
---|
41 | .setStroke({color: this.highlight}); |
---|
42 | shapes[3] = group.createCircle({cx: 0, cy: 0, r: this.width}) |
---|
43 | .setStroke(stroke) |
---|
44 | .setFill(color); |
---|
45 | return shapes; |
---|
46 | } |
---|
47 | }); |
---|
48 | }); |
---|