Debian Codegraph @

dojox/charting/tests/BidiSupport/bidi_Label_shortening.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>Chart 2D labels shortening</title>
19 <style type="text/css">
20 @import "../../../../dojo/resources/dojo.css";
21 @import "../../../../dijit/tests/css/dijitTests.css";
22 @import "../../../../dijit/themes/claro/claro.css";
23 </style>
24 <script type="text/javascript" src="../../../../dojo/dojo.js" data-dojo-config="isDebug: true, parseOnLoad: true, has:{'dojo-bidi': true}"></script>
25 <script type="text/javascript">
26 dojo.require("dojo.parser");
27 dojo.require("doh.runner");
28
29 dojo.require("dojox.charting.Chart");
30 dojo.require("dojox.charting.axis2d.Default");
31 dojo.require("dojox.charting.plot2d.Bars");
32 dojo.require("dojox.charting.plot2d.Columns");
33 dojo.require("dojox.charting.plot2d.Lines");
34 dojo.require("dojox.charting.plot2d.Areas");
35 dojo.require("dijit.Tooltip");
36
37 dojo.require("dijit.dijit");
38 dojo.require("dojox.charting.widget.Chart");
39 dojo.require("dojox.charting.plot2d.Grid");
40 dojo.require("dojox.charting.widget.Legend");
41 dojo.require("dojox.data.HtmlStore");
42
43 var seriesB = [260, 180, 200, 100, 140, 70, 200]
44 , chart1, chart2, chart3, chart4;
45
46 makeObjects = function(){
47 chart1 = new dojox.charting.Chart("test1", {textDir:"auto"}).
48 addAxis("x", {
49 fixLower: "major", fixUpper: "major", includeZero: true,
50 labels: [
51 {value: 0, text: "11111111111\u05d0."},
52 {value: 2, text: "\u05e9\u05ea\u05d9\u05d9\u05dd\u0020\u05e9\u05dc\u05d5\u05e9\u0020\u05d0\u05e8\u05d1\u05e2\u05e2\u05e2\u05e2."},
53 {value: 3, text: "11111111111\u05d0."},
54 {value: 5, text: "\u05d0."}
55 ],
56 maxLabelSize: 20,
57 trailingSymbol: ".",
58 htmlLabels: true
59 }).
60 addAxis("y", {
61 vertical: true, fixLower: "major", fixUpper: "major", natural: true,
62 labels: [{value: 0, text: ""},
63 {value: 1, text: "\u05d9\u05e0\u05d5\u05d0\u05e8."}, {value: 2, text: "February."},
64 {value: 3, text: "March."}, {value: 4, text: "\u05d0\u05e4\u05e8\u05d9\u05dc."},
65 {value: 5, text: "May."}, {value: 6, text: "11111111111\u05d0."}
66 ],
67 maxLabelSize: 20
68 }).
69 addPlot("default", {type: "Bars"}).
70 addSeries("Series A.", [1, 2, 3, 4, 5], {stroke: {color: "red"}, fill: "lightpink"}).
71 addSeries("Series B.", [5, 4, 3, 2, 1], {stroke: {color: "blue"}, fill: "lightblue"}).
72 render();
73
74 chart2 = new dojox.charting.Chart("test2").
75 addAxis("x", {
76 fixLower: "major", fixUpper: "major", includeZero: true,
77 labels: [
78 {value: 0, text: "first start point."},
79 {value: 2, text: "two."},
80 {value: 5, text: "111111111111111\u05d0."}
81 ],
82 rotation: 180,
83 maxLabelSize: 30
84 }).
85 addAxis("y", {
86 vertical: true, fixLower: "major", fixUpper: "major", natural: true, majorTickStep: 2,
87 labels: [{value: 0, text: ""},
88 {value: 1, text: "\u05d9\u05e0\u05d5\u05d0\u05e8."}, {value: 2, text: "February."},
89 {value: 3, text: "March."}, {value: 4, text: "\u05d0\u05e4\u05e8\u05d9\u05dc."},
90 {value: 5, text: "May."}, {value: 6, text: "June."}
91 ],
92 rotation: -30,
93 maxLabelSize: 20
94 }).
95 addPlot("default", {type: "Columns"}).
96 addSeries("Series A", [1, 2, 3, 4, 5], {stroke: {color: "red"}, fill: "lightpink"}).
97 addSeries("Series B", [5, 4, 3, 2, 1], {stroke: {color: "blue"}, fill: "lightblue"}).
98 render();
99
100 chart3 = new dojox.charting.Chart("test3").
101 addAxis("x", {
102 fixLower: "major", fixUpper: "major", includeZero: true,
103 labels: [
104 {value: 0, text: "first start point"},
105 {value: 2, text: "two"},
106 {value: 5, text: "1111111111111111111111111111\u05d0"}
107 ],
108 maxLabelCharCount: 5
109 }).
110 addAxis("y", {
111 vertical: true, fixLower: "major", fixUpper: "major", natural: true, majorTickStep: 2,
112 labels: [{value: 0, text: ""},
113 {value: 1, text: "\u05d9\u05e0\u05d5\u05d0\u05e8."}, {value: 2, text: "February."},
114 {value: 3, text: "March."}, {value: 4, text: "\u05d0\u05e4\u05e8\u05d9\u05dc."},
115 {value: 5, text: "May."}, {value: 6, text: "June."}
116 ],
117 maxLabelCharCount: 2,
118 trailingSymbol: "__"
119 }).
120 addPlot("default", {type: "Lines"}).
121 addSeries("Series A.", [1, 2, 3, 4, 5], {stroke: {color: "red"}, fill: "lightpink"}).
122 addSeries("Series B.", [5, 4, 3, 2, 1], {stroke: {color: "blue"}, fill: "lightblue"}).
123 render();
124
125 chart4 = new dojox.charting.Chart("test4", {textDir:"rtl"}).
126 addAxis("x", {
127 fixLower: "major", fixUpper: "major", includeZero: true,
128 labels: [
129 {value: 0, text: "\u05e8\u05d0\u05e9\u05d5\u05df\u0020\u05e9\u05e0\u05d9\u0020\u05e9\u05dc\u05d9\u05e9\u05d9\u05e9"},
130 {value: 2, text: "second middle point"},
131 {value: 5, text: "1111111111111111111111111111\u05d0."}
132 ],
133 maxLabelCharCount: 20,
134 maxLabelSize: 30
135 }).
136 addAxis("y", {
137 vertical: true, fixLower: "major", fixUpper: "major", natural: true, majorTickStep: 2,
138 labels: [{value: 0, text: ""},
139 {value: 1, text: "\u05d9\u05e0\u05d5\u05d0\u05e8"}, {value: 2, text: "February"},
140 {value: 3, text: "March"}, {value: 4, text: "\u05d0\u05e4\u05e8\u05d9\u05dc."},
141 {value: 5, text: "May"}, {value: 6, text: "June"}
142 ],
143 maxLabelCharCount: 2,
144 maxLabelSize: 40
145 }).
146 addPlot("default", {type: "Areas"}).
147 addSeries("Series A", [1, 2, 3, 4, 5], {stroke: {color: "red"}, fill: "lightpink"}).
148 addSeries("Series B", [5, 4, 3, 2, 1], {stroke: {color: "blue"}, fill: "lightblue"}).
149 render();
150 };
151
152 dojo.addOnLoad(function(){
153 makeObjects();
154
155 doh.register("test textDir", [
156 {
157 name: "Pies textDir",
158
159 runTest: function(){
160 doh.is("auto", chart1.textDir, "textDir of : chart1");
161 doh.is("ltr", chart2.textDir, "textDir of : chart2");
162 doh.is("ltr", chart3.textDir, "textDir of : chart3");
163 doh.is("rtl", chart4.textDir, "textDir of : chart4");
164
165 var node = dojo.byId("chart5");
166 var chart5 = dijit.byNode(node);
167 doh.is("auto", chart5.textDir, "textDir of : chart4");
168
169 }
170 }
171 ]);
172
173 doh.run();
174 });
175
176 </script>
177 </head>
178 <body class="claro">
179 <h1>Chart 2D labels shortening</h1>
180 <h2>Hover on the truncated label(end with default trailing Symbol: "..." or your customized trailing symbols) you will see the whole label on tooltip</h2>
181 <h2>1: Label shortening.(x axis customized trailing Symbol)
182 textDir = auto</h2>
183 <div id="test1" style="width: 300px; height: 200px;"></div>
184 <h2>2: Label shortening with rotation
185 textDir inherited.</h2>
186 <div id="test2" style="width: 300px; height: 200px;"></div>
187 <h2>3: Label shortening with limited character.(y axis customized trailing Symbol)
188 textDir inherited</h2>
189 <div id="test3" style="width: 300px; height: 200px;"></div>
190 <h2>4: Label shortening with both limited character and limited length in px
191 textDir = rtl.</h2>
192 <div id="test4" style="width: 300px; height: 200px;"></div>
193 <h2>5: Label shortening for HTML declared chart
194 textDir = auto.</h2>
195 <div dojoType="dojox.data.HtmlStore" dataId="tableExample" data-dojo-id="tableStore"></div>
196 <table id="tableExample" style="display: none;">
197 <thead>
198 <tr><th>value</th></tr>
199 </thead>
200 <tbody>
201 <tr><td>350</td></tr>
202 <tr><td>275</td></tr>
203 <tr><td>350 </td></tr>
204 <tr><td>400</td></tr>
205 <tr><td>250</td></tr>
206 <tr><td>350</td></tr>
207 <tr><td>200 </td></tr>
208 </tbody>
209 </table>
210 <table border="0" cellspacing="30">
211 <tr>
212 <td>
213 <div dojoType="dojox.charting.widget.Chart" id="chart5" textDir="auto" style="width: 500px; height: 500px;">
214 <div class="axis" name="x" maxLabelCharCount= 2 title="&#1511;&#1493;&#1512;&#1488;&#1497;&#1501; &#1500;&#1497; &#1510;&#1497;&#1512; X." titleOrientation= "away" font="italic normal normal 8pt Tahoma" labels="[{value:1, text:'First.'},{value:2, text:'&#1513;&#1514;&#1497;&#1497;&#1501; &#1513;&#1500;&#1493;&#1513;.'},{value:4, text:'111111111&#1514;.'}]"></div>
215 <div class="axis" name="y" maxLabelCharCount= 2 title="&#1511;&#1493;&#1512;&#1488;&#1497;&#1501; &#1500;&#1497; &#1510;&#1497;&#1512; Y." vertical="true" fixUpper="major" includeZero="true"
216 font="italic normal normal 8pt Tahoma"></div>
217 <div class="plot" name="default" type="Areas"></div>
218 <div class="plot" name="grid" type="Grid"></div>
219 <div class="series" name="&#1505;&#1491;&#1512;&#1492; 1." data="100, 200, 50, 15, 100, 28, 40"></div>
220 <div class="series" name="Run B." array="seriesB" ></div>
221 <div class="series" name="Run C." store="tableStore" valueFn="Number(x)"></div>
222 </div>
223 <div dojoType="dojox.charting.widget.Legend" chartRef="chart5"></div>
224 </td>
225 </tr>
226 </table>
227
228 <p>That's all Folks!</p>
229 </body>
230 </html>