summaryrefslogtreecommitdiff
path: root/includes/js/dojox/charting/tests/test_scaler.html
blob: f717f8339b77a07de2c3491e822b0ba34514436f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<html>
<head>
<title>Scaler/tick generator</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
	@import "../../../dojo/resources/dojo.css";
	@import "../../../dijit/tests/css/dijitTests.css";
</style>
<!--
The next line should include Microsoft's Silverligth.js, if you plan to use the silverlight backend
<script type="text/javascript" src="Silverlight.js"></script>
-->
<script type="text/javascript" src="../../../dojo/dojo.js" djConfig="isDebug: true"></script>
<script type="text/javascript" src="../scaler.js"></script>
<script type="text/javascript">

dojo.require("dojox.charting.scaler");

calc = function(){
	var min = parseFloat(dojo.byId("imin").value);
	var max = parseFloat(dojo.byId("imax").value);
	var span = parseFloat(dojo.byId("ispan").value);
	
	var o = dojox.charting.scaler(
		min, max, span, {
			fixLower: dojo.byId("ifl").value,
			fixUpper: dojo.byId("ifu").value,
			natural:  Boolean(dojo.byId("inat").checked)
		}
	);
	
	dojo.byId("imin").value = min;
	dojo.byId("imax").value = max;
	dojo.byId("ispan").value = span;
	
	dojo.byId("olb").innerHTML = o.bounds.lower;
	dojo.byId("oub").innerHTML = o.bounds.upper;
	
	dojo.byId("omajt").innerHTML = o.major.tick;
	dojo.byId("omajs").innerHTML = o.major.start;
	dojo.byId("omajc").innerHTML = o.major.count;
	dojo.byId("omajp").innerHTML = o.major.prec;
	
	dojo.byId("omint").innerHTML = o.minor.tick;
	dojo.byId("omins").innerHTML = o.minor.start;
	dojo.byId("ominc").innerHTML = o.minor.count;
	dojo.byId("ominp").innerHTML = o.minor.prec;
	
	dojo.byId("omict").innerHTML = o.micro.tick;
	dojo.byId("omics").innerHTML = o.micro.start;
	dojo.byId("omicc").innerHTML = o.micro.count;
	dojo.byId("omicp").innerHTML = o.micro.prec;
	
	dojo.byId("oscale").innerHTML = o.scale;
};

</script>
</head>
<body>
<h1>Scaler/tick generator</h1>
<h2>Input</h2>
<table>
	<tr><th>Name</th><th>Value</th></tr>
	<tr><td>min</td><td><input type="text" id="imin" /></td></tr>
	<tr><td>max</td><td><input type="text" id="imax" /></td></tr>
	<tr><td>span</td><td><input type="text" id="ispan" /></td></tr>
	<tr><td>natural</td><td><input type="checkbox" id="inat" /></td></tr>
	<tr><td>fixLower</td><td><input type="text" id="ifl" /></td></tr>
	<tr><td>fixUpper</td><td><input type="text" id="ifu" /></td></tr>
</table>
<p><button onclick="calc()">Calculate!</button></p>
<h2>Output</h2>
<table>
	<tr><th>Name</th><th>Value</th></tr>
	
	<tr><td>lowerBound</td><td><span id="olb">&nbsp;</span></td></tr>
	<tr><td>upperBound</td><td><span id="oub">&nbsp;</span></td></tr>
	
	<tr><td>major.tick</td><td><span id="omajt">&nbsp;</span></td></tr>
	<tr><td>major.start</td><td><span id="omajs">&nbsp;</span></td></tr>
	<tr><td>major.count</td><td><span id="omajc">&nbsp;</span></td></tr>
	<tr><td>major.prec</td><td><span id="omajp">&nbsp;</span></td></tr>

	<tr><td>minor.tick</td><td><span id="omint">&nbsp;</span></td></tr>
	<tr><td>minor.start</td><td><span id="omins">&nbsp;</span></td></tr>
	<tr><td>minor.count</td><td><span id="ominc">&nbsp;</span></td></tr>
	<tr><td>minor.prec</td><td><span id="ominp">&nbsp;</span></td></tr>

	<tr><td>micro.tick</td><td><span id="omict">&nbsp;</span></td></tr>
	<tr><td>micro.start</td><td><span id="omics">&nbsp;</span></td></tr>
	<tr><td>micro.count</td><td><span id="omicc">&nbsp;</span></td></tr>
	<tr><td>micro.prec</td><td><span id="omicp">&nbsp;</span></td></tr>

	<tr><td>scale</td><td><span id="oscale">&nbsp;</span></td></tr>
</table>
</body>
</html>