Debian Codegraph @

dojox/dgauges/tests/gauges/SimpleCircularGauge.js

raw symbols SCIP
1 define(["dojo/_base/lang", "dojo/_base/declare", "dojox/dgauges/CircularGauge", "dojox/dgauges/LinearScaler",
2 "dojox/dgauges/CircularScale", "dojox/dgauges/CircularValueIndicator", "dojox/dgauges/CircularRangeIndicator",
3 "dojox/dgauges/TextIndicator"],
4 function(lang, declare, CircularGauge, LinearScaler, CircularScale, CircularValueIndicator, CircularRangeIndicator,
5 TextIndicator){
6 return declare("dojox.dgauges.tests.gauges.SimpleCircularGauge", CircularGauge, {
7 constructor: function(){
8 // Changes the font
9 this.font = {
10 family: "Helvetica",
11 style: "normal",
12 size: "10pt",
13 color: "white"
14 };
15
16 // Draws the background
17 this.addElement("background", function(g){
18 g.createEllipse({
19 cx: 100,
20 cy: 100,
21 rx: 100,
22 ry: 100
23 }).setFill("#444444");
24 });
25
26 // The scaler
27 var scaler = new LinearScaler({
28 minimum: -100,
29 maximum: 100,
30 majorTickInterval: 20,
31 minorTickInterval: 5
32 });
33
34 // The scale
35 var scale = new CircularScale({
36 scaler: scaler,
37 originX: 100,
38 originY: 100,
39 startAngle: 110,
40 endAngle: 70,
41 radius: 75,
42 labelPosition: "outside",
43 tickShapeFunc: function(group, scale, tick){
44 return group.createLine({
45 x1: tick.isMinor ? 2 : 0,
46 y1: 0,
47 x2: tick.isMinor ? 8 : 12,
48 y2: 0
49 }).setStroke({
50 color: tick.isMinor ? "black" : "white",
51 width: tick.isMinor ? 0.5 : 1
52 })
53 }
54 });
55 this.addElement("scale", scale);
56
57 // A value indicator
58 var indicator = new CircularValueIndicator({
59 interactionArea: "indicator",
60 indicatorShapeFunc: function(group){
61 return group.createPolyline([20, -6, 60, 0, 20, 6, 20, -6]).setFill("black").setStroke("white");
62 },
63 value: 50
64 });
65 scale.addIndicator("indicator", indicator);
66
67 // A green range indicator
68 var rangeIndicator = new CircularRangeIndicator({
69 start: 0,
70 value: 100,
71 radius: 62,
72 startThickness:10,
73 endThickness: 30,
74 fill: "green",
75 interactionMode: "none"
76 });
77 scale.addIndicator("rangeIndicator", rangeIndicator, true);
78
79
80 // Indicator Text"
81 this.addElement("text", new TextIndicator({
82 value: "G", x:100, y:100
83 }));
84 }
85 });
86 });