Debian Codegraph @

dojox/charting/tests/test_chartAxisTitle.html

raw symbols SCIP
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 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
18 <title>Chart2D Title</title>
19 <style type="text/css">
20 @import "../../../dojo/resources/dojo.css";
21 @import "../../../dijit/tests/css/dijitTests.css";
22 @import "../../../dijit/themes/tundra/tundra.css";
23
24 .axisTitleRotation90 {
25 transform: rotate(90deg);
26 -o-transform: rotate(90deg);
27 -webkit-transform: rotate(90deg);
28 -moz-transform: rotate(90deg);
29 }
30 .axisTitleRotation180 {
31 transform: rotate(180deg);
32 -o-transform: rotate(180deg);
33 -webkit-transform: rotate(180deg);
34 -moz-transform: rotate(180deg);
35 }
36 .axisTitleRotation270 {
37 transform: rotate(-90deg);
38 -o-transform: rotate(-90deg);
39 -webkit-transform: rotate(-90deg);
40 -moz-transform: rotate(-90deg);
41 }
42 </style>
43 <script type="text/javascript" src="../../../dojo/dojo.js" data-dojo-config="isDebug: true, parseOnLoad: true"></script>
44 <script type="text/javascript">
45
46 dojo.require("dojox.charting.Chart");
47 dojo.require("dojox.charting.axis2d.Default");
48 dojo.require("dojox.charting.plot2d.Lines");
49 dojo.require("dojox.charting.plot2d.Markers");
50 dojo.require("dojox.charting.plot2d.Columns");
51 dojo.require("dojox.charting.themes.PlotKit.blue");
52 dojo.require("dojox.charting.themes.PlotKit.cyan");
53 dojo.require("dojox.charting.themes.PlotKit.green");
54 dojo.require("dojox.charting.themes.PlotKit.orange");
55 dojo.require("dojox.charting.themes.PlotKit.purple");
56 dojo.require("dojox.charting.themes.PlotKit.red");
57 dojo.require("dijit.form.Button");
58 dojo.require("dijit.form.NumberSpinner");
59 dojo.require("dojo.parser");
60 var chart1;
61
62 updateAxis = function(){
63 var gap = dijit.byId("axisTitleGap").get("value"),
64 rotation = dijit.byId("rotation").get("value"),
65 orientation = dojo.byId("orientation").value || "axis";
66 chart1.addAxis("x", {
67 title: "Quarter of 2010",
68 titleGap: gap,
69 titleFontColor: "orange",
70 titleOrientation: orientation,
71 rotation: rotation,
72 includeZero: true, natural: true, fixLower: "major", fixUpper: "major",
73 labels: [
74 {value: 0, text: ""},{value: 1, text: "1 Qtr"},{value: 2, text: "2 Qtr"},
75 {value: 3, text: "3 Qtr"},{value: 4, text: "4 Qtr"},{value: 5, text: "End"}
76 ]
77 }).
78 addAxis("y", {
79 title: "Revenue(million)",
80 titleGap: gap,
81 titleFontColor: "orange",
82 titleOrientation: orientation,
83 rotation: rotation,
84 vertical: true, includeZero: true, natural: true, fixLower: "major", fixUpper: "major", majorTickStep: 2,
85 labels: [
86 {value: 0, text: ""},{value: 1, text: "One"},{value: 2, text: "Two"},
87 {value: 3, text: "Three"},{value: 4, text: "Four"},{value: 5, text: "Five"},{value: 6, text: "Six"}
88 ]
89 }).
90 addAxis("x2", {
91 title: "Quarter of 2010",
92 titleGap: gap,
93 titleFontColor: "blue",
94 titleOrientation: orientation,
95 rotation: rotation,
96 leftBottom: false,
97 includeZero: true, natural: true, fixLower: "major", fixUpper: "major"
98 }).
99 addAxis("y2", {
100 title: "Quantity(ton)",
101 titleGap: gap,
102 titleFontColor: "blue",
103 titleOrientation: orientation,
104 rotation: rotation,
105 leftBottom: false,
106 vertical: true, includeZero: true, natural: true, fixLower: "major", fixUpper: "major", majorTickStep: 2
107 }).
108 render();
109 };
110
111 makeObjects = function(){
112 chart1 = new dojox.charting.Chart("test1").
113 addPlot("default", {type: "Lines"}).
114 addSeries("Series A", [3, 5, 3, 4, 2], {stroke: {color: "orange"}, fill: "yellow"}).
115 addPlot("default2", {type: "Columns", gap: 15, hAxis: "x2", vAxis: "y2"}).
116 addSeries("Series B", [12, 8, 15, 20], {plot: "default2", stroke: {color: "blue"}, fill: "lightblue"});
117 updateAxis();
118
119 var chart2 = new dojox.charting.Chart("test2").
120 addAxis("x", {
121 title: "Month of 2010",
122 titleGap: 20,
123 titleFont: "normal normal normal 10pt Arial",
124 titleFontColor: "green",
125 titleOrientation: "away",
126 rotation: 30,
127 includeZero: true, natural: true, fixLower: "major", fixUpper: "major",
128 labels: [
129 {value: 0, text: ""},{value: 1, text: "Jan"},{value: 2, text: "Feb"},
130 {value: 3, text: "Mar"},{value: 4, text: "Aprl"},{value: 5, text: "May"}
131 ]
132 }).
133 addAxis("y", {
134 title: "Production(Quantity)",
135 titleGap: 15,
136 titleFont: "normal normal normal 10pt Arial",
137 titleFontColor: "orange",
138 titleOrientation: "axis",
139 vertical: true, includeZero: true, natural: true,
140 fixLower: "major", fixUpper: "major", majorTickStep: 30000
141 }).
142 addPlot("default", {type: "Markers"}).
143 addSeries("Series A", [200000, 80000, 120000, 140000, 150000], {stroke: {color: "red"}, fill: "lightpink"}).
144 addSeries("Series B", [30000, 60000, 90000, 120000, 200000], {stroke: {color: "blue"}, fill: "lightblue"}).
145 render();
146 };
147
148 dojo.addOnLoad(makeObjects);
149
150
151
152
153 </script>
154 </head>
155 <body class="tundra">
156 <h1>Chart2D Titles</h1>
157 <p>Column chart with axis title</p>
158 <p>
159 Axis Title Gap:&nbsp;
160 <input dojoType="dijit.form.NumberSpinner" id="axisTitleGap" value="15" constraints="{min: 0, max: 50, fractional: false}" style="width: 8em;">
161 &nbsp;&nbsp;
162 Axis Rotation
163 <input dojoType="dijit.form.NumberSpinner" id="rotation" value="0" constraints="{min: 0, max: 360, fractional: false}" style="width: 8em;">
164 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
165 <select id="orientation">
166 <option value="axis">axis title facing the axis</option>
167 <option value="away">axis title facing away</option>
168 </select>
169 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
170 <button dojoType="dijit.form.Button" onClick="updateAxis()">Apply</button>
171 </p>
172 <div id="test1" style="width: 500px; height: 400px;"></div>
173 <p>Line chart with customized axis title</p>
174 <div id="test2" style="width: 500px; height: 400px;"></div>
175 </body>
176 </html>