Debian Codegraph @

dojox/dgauges/components/black/CircularLinearGauge.js

raw symbols SCIP
1 define([
2 "dojo/_base/lang",
3 "dojo/_base/declare",
4 "dojo/_base/Color",
5 "../../CircularGauge",
6 "../../LinearScaler",
7 "../../CircularScale",
8 "../../CircularValueIndicator",
9 "../../CircularRangeIndicator",
10 "../DefaultPropertiesMixin"
11 ],
12 function(lang, declare, Color, CircularGauge, LinearScaler, CircularScale, CircularValueIndicator, CircularRangeIndicator, DefaultPropertiesMixin){
13 return declare("dojox.dgauges.components.black.CircularLinearGauge", [CircularGauge, DefaultPropertiesMixin], {
14 // summary:
15 // A circular gauge widget.
16
17 // borderColor: Object|Array|int
18 // The border color. Default is "#000000".
19 borderColor: "#000000",
20 // fillColor: Object|Array|int
21 // The background color. Default is "#000000".
22 fillColor: "#000000",
23 // indicatorColor: Object|Array|int
24 // The indicator fill color. Default is "#A4A4A4".
25 indicatorColor: "#A4A4A4",
26 constructor: function(){
27 // Base colors
28 this.borderColor = new Color(this.borderColor);
29 this.fillColor = new Color(this.fillColor);
30 this.indicatorColor = new Color(this.indicatorColor);
31
32 var scaler = new LinearScaler();
33 this.addElement("background", lang.hitch(this, this.drawBackground));
34 var scale = new CircularScale();
35 scale.set("scaler", scaler);
36 scale.set("radius", 149.82183);
37 scale.set("originX", 186.9446);
38 scale.set("originY", 184.74838);
39 scale.set("startAngle", 130.16044);
40 scale.set("endAngle", 50.25444);
41 scale.set("orientation", "clockwise");
42 scale.set("labelGap", 8);
43 scale.set("font", {
44 family: "Helvetica",
45 weight: "bold",
46 size: "14pt",
47 color: "#CECECE"
48 });
49 scale.set("tickShapeFunc", function(group, scale, tick){
50 return group.createCircle({
51 r: tick.isMinor ? 2 : 4
52 }).setFill("#CECECE");
53 });
54 this.addElement("scale", scale);
55 var indicator = new CircularValueIndicator();
56 indicator.set("interactionArea", "gauge");
57 indicator.set("value", scaler.minimum);
58 indicator.set("indicatorShapeFunc", lang.hitch(this, function(group, indicator){
59
60 return group.createPolyline([0, -12, indicator.scale.radius - 2, 0, 0, 12, 0, -12]).setStroke({
61 color: [70, 70, 70],
62 width: 1
63 }).setFill(this.indicatorColor);
64
65 }));
66 scale.addIndicator("indicator", indicator);
67 this.addElement("foreground", lang.hitch(this, this.drawForeground));
68 },
69 drawBackground: function(g){
70 // summary:
71 // Draws the background shape of the gauge.
72 // g: dojox/gfx/Group
73 // The group used to draw the background.
74 // tags:
75 // protected
76 g.createPath({
77 path: "M372.9962 186.58 C373.0312 289.5712 289.57 373.0888 186.5787 373.1237 C83.5887 373.16 0.07 289.6975 0.035 186.7062 L0.035 186.58 C-0 83.5888 83.4625 0.0712 186.4524 0.0362 C289.4425 -0 372.9611 83.4625 372.9962 186.4525 L372.9962 186.58 Z"
78 }).setFill(this.borderColor);
79 g.createPath({
80 path: "M358.7902 186.5795 C358.8253 281.7258 281.7202 358.8808 186.574 358.9145 C91.4277 358.9471 14.2715 281.842 14.239 186.6957 L14.239 186.5795 C14.2077 91.4332 91.3127 14.2782 186.4565 14.2445 C281.6027 14.2132 358.759 91.317 358.7902 186.4633 L358.7902 186.5795 Z"
81 }).setFill({
82 type: "linear",
83 x1: 14.23897,
84 y1: 358.91452,
85 x2: 14.23897,
86 y2: 221.04652,
87 colors: [
88 {offset: 0, color: [100,100,100]},
89 {offset: 1, color: this.fillColor}
90 ]
91 });
92 g.createPath({
93 path: "M358.749 182.9033 C356.8202 89.4033 280.4165 14.2132 186.4615 14.2445 C92.5465 14.277 16.2165 89.4533 14.289 182.9008 C66.884 197.0646 127.4052 168.8146 188.7977 168.8146 C250.209 168.8146 306.3027 197.0708 358.749 182.9033"
94 }).setFill({
95 type: "linear",
96 x1: 14.28899,
97 y1: 186.87839,
98 x2: 14.28899,
99 y2: 14.24451,
100 colors: [
101 {offset: 0, color: this.fillColor},
102 {offset: 1, color: [200,200,200]}
103 ]
104 });
105 g.createPath({
106 path: "M358.7457 182.9033 C356.817 89.4033 280.4132 14.2133 186.4582 14.2445 C92.5432 14.277 16.2132 89.4533 14.2857 182.9008 C66.8807 197.0646 127.402 168.8146 188.7945 168.8146 C250.2057 168.8146 306.2995 197.0708 358.7457 182.9033"
107 }).setFill([255,255,255,0.12157]);
108 },
109
110 drawForeground: function(g){
111 // summary:
112 // Draws the foreground shape of the gauge.
113 // g: dojox/gfx/Group
114 // The group used to draw the foreground.
115 // tags:
116 // protected
117 var g1 = g.createGroup();
118 g1.createPath({
119 path: "M214.9859 185.33 C214.9909 201.0537 202.2496 213.8037 186.5259 213.81 C170.7996 213.815 158.0496 201.0725 158.0446 185.35 L158.0446 185.33 C158.0384 169.6062 170.7821 156.8562 186.5071 156.85 C202.2296 156.845 214.9809 169.5875 214.9859 185.3113 L214.9859 185.33 Z"
120 }).setFill(this.borderColor);
121 g1.createPath({
122 path: "M211.4015 185.3295 C211.4052 199.0745 200.2689 210.2183 186.524 210.2232 C172.7802 210.2282 161.6352 199.0908 161.6302 185.347 L161.6302 185.3295 C161.6252 171.5858 172.7628 160.4408 186.5065 160.4358 C200.2515 160.4308 211.3965 171.5695 211.4015 185.3133 L211.4015 185.3295 Z"
123 }).setFill({
124 type: "linear",
125 x1: 161.63024,
126 y1: 210.22326,
127 x2: 161.63024,
128 y2: 185.32952,
129 colors: [
130 {offset: 0, color: [100,100,100]},
131 {offset: 1, color: this.fillColor}
132 ]
133 });
134 g1.createPath({
135 path: "M211.3952 184.7995 C211.1165 171.2933 200.0802 160.4308 186.5077 160.4358 C172.9415 160.4408 161.9152 171.2995 161.6377 184.7995 C169.234 186.8446 177.9752 182.7645 186.8465 182.7645 C195.7165 182.7645 203.819 186.8458 211.3952 184.7995"
136 }).setFill({
137 type: "linear",
138 x1: 161.63772,
139 y1: 185.37364,
140 x2: 161.63772,
141 y2: 160.43577,
142 colors: [
143 {offset: 0, color: this.fillColor},
144 {offset: 1, color: [150,150,150]}
145 ]
146 });
147 g1.createPath({
148 path: "M211.3946 184.799 C211.1158 171.2928 200.0796 160.4315 186.5084 160.4365 C172.9409 160.4415 161.9159 171.3003 161.6371 184.799 C169.2334 186.844 177.9759 182.764 186.8458 182.764 C195.7158 182.764 203.8184 186.8465 211.3946 184.799"
149 }).setFill([255,255,255,0.12157]);
150 }
151 });
152 }
153 );
154