1 | <!--[if IE 7]> |
---|
2 | <!DOCTYPE> |
---|
3 | <html lang="en"> |
---|
4 | <head> |
---|
5 | <![endif]--> |
---|
6 | <!--[if IE 8]> |
---|
7 | <!DOCTYPE> |
---|
8 | <html lang="en"> |
---|
9 | <head> |
---|
10 | <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"/> |
---|
11 | <![endif]--> |
---|
12 | <![if gte IE 9]> |
---|
13 | <!DOCTYPE HTML> |
---|
14 | <html lang="en"> |
---|
15 | <head> |
---|
16 | <![endif]> |
---|
17 | <title>Threshold Indicator</title> |
---|
18 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
---|
19 | <style type="text/css"> |
---|
20 | @import "../../../dojo/resources/dojo.css"; |
---|
21 | @import "../../../dijit/themes/tundra/tundra.css"; |
---|
22 | </style> |
---|
23 | <script type="text/javascript" src="../../../dojo/dojo.js" |
---|
24 | data-dojo-config="isDebug: true"></script> |
---|
25 | <script type="text/javascript"> |
---|
26 | require(["dojo/ready", "dojox/charting/Chart", "dojox/charting/axis2d/Default", "dojox/charting/plot2d/Default", |
---|
27 | "dojox/charting/action2d/MouseZoomAndPan", "dojox/charting/plot2d/Indicator", "dojox/charting/action2d/PlotAction"], |
---|
28 | function(ready, Chart, Axis, Plot, MouseZoomAndPan, Indicator, PlotAction){ |
---|
29 | ready(function(){ |
---|
30 | var chart = new Chart("chart", { margins : {l :20, t:30, b:10, r: 50} }); |
---|
31 | chart.addAxis("x", { |
---|
32 | type : Axis, |
---|
33 | font: "normal normal normal 14pt Tahoma", |
---|
34 | fixLower : "minor", |
---|
35 | natural : true, |
---|
36 | stroke : "gray", |
---|
37 | majorTick : { |
---|
38 | color : "red", |
---|
39 | length : 4 |
---|
40 | }, |
---|
41 | minorTick : { |
---|
42 | color : "blue", |
---|
43 | length : 2 |
---|
44 | } |
---|
45 | }); |
---|
46 | chart.addAxis("y", { |
---|
47 | vertical : true, |
---|
48 | font: "normal normal normal 14pt Tahoma", |
---|
49 | min : 0, |
---|
50 | max : 100, |
---|
51 | majorTickStep : 10, |
---|
52 | minorTickStep : 5, |
---|
53 | stroke : "gray", |
---|
54 | majorTick : { |
---|
55 | stroke : "black", |
---|
56 | length : 4 |
---|
57 | }, |
---|
58 | minorTick : { |
---|
59 | stroke : "gray", |
---|
60 | length : 2 |
---|
61 | } |
---|
62 | }); |
---|
63 | chart.addPlot("default", { |
---|
64 | type : Plot |
---|
65 | }); |
---|
66 | chart.addPlot("thresholdh", { |
---|
67 | type: Indicator, |
---|
68 | vertical: false, |
---|
69 | lineStroke: { color: "red", style: "ShortDash"}, |
---|
70 | stroke: null, |
---|
71 | outline: null, |
---|
72 | fill: null, |
---|
73 | offset: { y: -7, x: -10 }, |
---|
74 | values: 15 |
---|
75 | }); |
---|
76 | chart.addPlot("thresholdv", { |
---|
77 | type: Indicator, |
---|
78 | lineStroke: { color: "blue", style: "ShortDash"}, |
---|
79 | stroke: null, |
---|
80 | outline: null, |
---|
81 | fill: null, |
---|
82 | offset: { y: -7, x: 0 }, |
---|
83 | values: 5 |
---|
84 | }); |
---|
85 | chart.addPlot("thresholdhb", { |
---|
86 | type: Indicator, |
---|
87 | vertical: false, |
---|
88 | lineStroke: { color: "red", style: "ShortDash"}, |
---|
89 | stroke: null, |
---|
90 | outline: null, |
---|
91 | fill: null, |
---|
92 | offset: { y: -7, x: 10 }, |
---|
93 | start: true, |
---|
94 | values: [35] |
---|
95 | }); |
---|
96 | chart.addPlot("thresholdvb", { |
---|
97 | type: Indicator, |
---|
98 | lineStroke: { color: "blue", style: "ShortDash"}, |
---|
99 | stroke: null, |
---|
100 | outline: null, |
---|
101 | fill: null, |
---|
102 | start: true, |
---|
103 | offset: { y: -7, x: -40 }, |
---|
104 | labels: "markers", |
---|
105 | values: [20] |
---|
106 | }); |
---|
107 | chart.addPlot("thresholdual", { |
---|
108 | type: Indicator, |
---|
109 | vertical: false, |
---|
110 | lineStroke: { color: "blue", width: 2}, |
---|
111 | color: "red", |
---|
112 | stroke: null, |
---|
113 | outline: null, |
---|
114 | fill: null, |
---|
115 | offset: { y: -7, x: -10 }, |
---|
116 | lineFill: [0, 10, 50, 0.4], |
---|
117 | values: [50, 90] |
---|
118 | }); |
---|
119 | chart.addSeries("markers 1", [ 8, 17, 30 ], { plot: "thresholdvb" }); |
---|
120 | chart.addSeries("markers 2", [ 8, 17, 30 ], { plot: "thresholdhb" }); |
---|
121 | chart.addSeries("Series A", [ 8, 7, 3, 2, 5, 7, 9, 10, 2, 10, 14, 16, |
---|
122 | 29, 13, 16, 15, 20, 19, 15, 12, 24, 20, 20, 26, 28, 26, 28, 14, |
---|
123 | 24, 29, 31, 35, 37, 31, 35, 37, 37, 36, 31, 30, 50, 49, 42, 46, |
---|
124 | 44, 40, 47, 43, 48, 47, 51, 52, 52, 51, 54, 57, 58, 50, 54, 51, |
---|
125 | 74, 68, 67, 62, 62, 65, 61, 66, 65, 62, 74, 78, 78, 77, 74, 62, |
---|
126 | 72, 74, 70, 78, 84, 83, 85, 86, 86, 89, 89, 85, 86, 86, 98, 73, |
---|
127 | 93, 91, 92, 92, 99, 93, 94, 92 ]); |
---|
128 | new MouseZoomAndPan(chart, "default", { axis: "x" }); |
---|
129 | var action = new PlotAction(chart, "thresholdh"); |
---|
130 | action.process = function(o){ |
---|
131 | if(o.type == "onclick"){ |
---|
132 | console.log("down on thresholdh"); |
---|
133 | } |
---|
134 | }; |
---|
135 | action.connect(); |
---|
136 | chart.render(); |
---|
137 | }); |
---|
138 | }) |
---|
139 | </script> |
---|
140 | </head> |
---|
141 | <body class="tundra" style="height: 100%; width: 100%"> |
---|
142 | <div id="chart" style="width: 100%; height: 100%;"></div> |
---|
143 | </body> |
---|
144 | </html> |
---|