Debian Codegraph @

dojox/dgauges/components/grey/VerticalLinearGauge.js

raw symbols SCIP
1 define([
2 "dojo/_base/lang",
3 "dojo/_base/declare",
4 "dojo/_base/Color",
5 "../../RectangularGauge",
6 "../../LinearScaler",
7 "../../RectangularScale",
8 "../../RectangularValueIndicator",
9 "../DefaultPropertiesMixin"
10 ],
11 function(lang, declare, Color, RectangularGauge, LinearScaler, RectangularScale, RectangularValueIndicator, DefaultPropertiesMixin){
12 return declare("dojox.dgauges.components.grey.VerticalLinearGauge", [RectangularGauge, DefaultPropertiesMixin], {
13 // summary:
14 // A vertical gauge widget.
15
16 // borderColor: Object|Array|int
17 // The border color. Default is "#9498A1".
18 borderColor: [148,152,161],
19 // fillColor: Object|Array|int
20 // The background color. Default is "#9498A1".
21 fillColor: [148,152,161],
22 // indicatorColor: Object|Array|int
23 // The indicator fill color. Default is "#3F3F3F".
24 indicatorColor: [63,63,63],
25 constructor: function(){
26 this.orientation = "vertical";
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 this.addElement("background", lang.hitch(this, this.drawBackground));
33
34 // Scaler
35 var scaler = new LinearScaler();
36
37 // Scale
38 var scale = new RectangularScale();
39 scale.set("scaler", scaler);
40 scale.set("labelPosition", "trailing");
41 scale.set("paddingTop", 30);
42 scale.set("paddingBottom", 30);
43 scale.set("paddingLeft", 15);
44 scale.set("labelGap", 4);
45 scale.set("font", {
46 family: "Helvetica",
47 weight: "bold",
48 size: "7pt"
49 });
50 this.addElement("scale", scale);
51
52 var indicator = new RectangularValueIndicator();
53 indicator.set("interactionArea", "gauge");
54 indicator.set("value", scaler.minimum);
55 indicator.set("paddingLeft", 22);
56 indicator.set("indicatorShapeFunc", lang.hitch(this, function(group){
57
58 group.createPath().moveTo(0, 0).lineTo(-10, -20).lineTo(10, -20).lineTo(0, 0).closePath().setFill(this.indicatorColor);
59 return group;
60
61 }));
62 scale.addIndicator("indicator", indicator);
63 },
64
65 drawBackground: function(g, w, h){
66 // summary:
67 // Draws the background shape of the gauge.
68 // g: dojox/gfx/Group
69 // The group used to draw the background.
70 // w: Number
71 // The width of the gauge.
72 // h: Number
73 // The height of the gauge.
74 // tags:
75 // protected
76 g.createRect({
77 x: 0,
78 y: 0,
79 width: 50,
80 height: h,
81 r: 13.5
82 }).setFill(this.borderColor);
83 g.createRect({
84 x: 2,
85 y: 2,
86 width: 46,
87 height: h - 4,
88 r: 11.5
89 }).setFill({
90 type: "linear",
91 x1: -2,
92 y1: 0,
93 x2: 60,
94 y2: 0,
95 colors: [
96 {offset: 0, color: "white"},
97 {offset: 1, color: this.fillColor}
98 ]
99 });
100 g.createPath().moveTo(25, 2).hLineTo(38).smoothCurveTo(48, 2, 48, 18).vLineTo(h - 16).smoothCurveTo(48, h - 2, 38, h - 2).closePath().setFill({
101 type: "linear",
102 x1: -10,
103 y1: 0,
104 x2: 60,
105 y2: 0,
106 colors: [
107 {offset: 0, color: this.fillColor},
108 {offset: 1, color: "white"}
109 ]
110 });
111 }
112
113 });
114 }
115 );
116