| 1 |
define(["dojo/_base/declare","dojo/_base/Color","./BarLineIndicator"], |
| 2 |
function(declare, Color, BarLineIndicator) { |
| 3 |
|
| 4 |
return declare("dojox.gauges.GlossyHorizontalGaugeMarker", [BarLineIndicator], { |
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
interactionMode: "gauge", |
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
color: 'black', |
| 23 |
|
| 24 |
_getShapes: function(group){ |
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
if (!this._gauge){ |
| 29 |
return null; |
| 30 |
} |
| 31 |
var v = this.value; |
| 32 |
if (v < this._gauge.min){ |
| 33 |
v = this._gauge.min; |
| 34 |
} |
| 35 |
if (v > this._gauge.max){ |
| 36 |
v = this._gauge.max; |
| 37 |
} |
| 38 |
|
| 39 |
var pos = this._gauge._getPosition(v); |
| 40 |
var shapes = []; |
| 41 |
|
| 42 |
var color = new Color(this.color); |
| 43 |
color.a = .67; |
| 44 |
|
| 45 |
var lighterColor = Color.blendColors(color, new Color('white'), 0.4); |
| 46 |
|
| 47 |
var top = shapes[0] = group.createGroup(); |
| 48 |
var scale = this._gauge.height / 100; |
| 49 |
scale = Math.max(scale, .5); |
| 50 |
scale = Math.min(scale, 1); |
| 51 |
|
| 52 |
top.setTransform({ |
| 53 |
xx: 1, |
| 54 |
xy: 0, |
| 55 |
yx: 0, |
| 56 |
yy: 1, |
| 57 |
dx: pos, |
| 58 |
dy: 0 |
| 59 |
}); |
| 60 |
var marker = top.createGroup().setTransform({ |
| 61 |
xx: 1, |
| 62 |
xy: 0, |
| 63 |
yx: 0, |
| 64 |
yy: 1, |
| 65 |
dx: -scale * 10, |
| 66 |
dy: this._gauge.dataY + this.offset |
| 67 |
}); |
| 68 |
var rescale = marker.createGroup().setTransform({ |
| 69 |
xx: scale, |
| 70 |
xy: 0, |
| 71 |
yx: 0, |
| 72 |
yy: scale, |
| 73 |
dx: 0, |
| 74 |
dy: 0 |
| 75 |
}); |
| 76 |
|
| 77 |
rescale.createRect({ |
| 78 |
x: .5, |
| 79 |
y: .0, |
| 80 |
width: 20, |
| 81 |
height: 47, |
| 82 |
r: 6 |
| 83 |
}).setFill(color).setStroke(lighterColor); |
| 84 |
rescale.createPath({ |
| 85 |
path: 'M 10.106 41 L 10.106 6 C 10.106 2.687 7.419 0 4.106 0 L 0.372 0 C -0.738 6.567 1.022 15.113 1.022 23.917 C 1.022 32.721 2.022 40.667 0.372 47 L 4.106 47 C 7.419 47 10.106 44.314 10.106 41 Z' |
| 86 |
}).setFill(lighterColor).setTransform({ |
| 87 |
xx: 1, |
| 88 |
xy: 0, |
| 89 |
yx: 0, |
| 90 |
yy: 1, |
| 91 |
dx: 10.306, |
| 92 |
dy: 0.009 |
| 93 |
}); |
| 94 |
rescale.createRect({ |
| 95 |
x: 9.5, |
| 96 |
y: 1.5, |
| 97 |
width: 2, |
| 98 |
height: 34, |
| 99 |
r: 0.833717 |
| 100 |
}).setFill(color).setStroke(this.color); |
| 101 |
rescale.createRect({ |
| 102 |
x: 9, |
| 103 |
y: 0, |
| 104 |
width: 3, |
| 105 |
height: 34, |
| 106 |
r: 6 |
| 107 |
}).setFill({ |
| 108 |
type: "linear", |
| 109 |
x1: 9, |
| 110 |
y1: 0, |
| 111 |
x2: 9, |
| 112 |
y2: 34, |
| 113 |
colors: [{ |
| 114 |
offset: 0, |
| 115 |
color: 'white' |
| 116 |
}, { |
| 117 |
offset: 1, |
| 118 |
color: this.color |
| 119 |
}] |
| 120 |
}); |
| 121 |
return shapes; |
| 122 |
} |
| 123 |
|
| 124 |
}); |
| 125 |
}); |