| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 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>Testing Axes</title> |
| 19 |
<style type="text/css"> |
| 20 |
@import "../../../../dojo/resources/dojo.css"; |
| 21 |
@import "../../../../dijit/tests/css/dijitTests.css"; |
| 22 |
</style> |
| 23 |
<script type="text/javascript" src="../../../../dojo/dojo.js" data-dojo-config="async: true, isDebug: true, has:{'dojo-bidi': true}"></script> |
| 24 |
<script type="text/javascript"> |
| 25 |
var chart1a, chart1b; |
| 26 |
function rotationXChanged(value){ |
| 27 |
value = parseInt(value); |
| 28 |
chart1a.getAxis("x").opt.rotation = value; |
| 29 |
chart1a.dirty = true; |
| 30 |
chart1a.setDir("rtl").render(); |
| 31 |
chart1b.getAxis("x").opt.rotation = value; |
| 32 |
chart1b.dirty = true; |
| 33 |
chart1b.setDir("rtl").render(); |
| 34 |
} |
| 35 |
function rotationYChanged(value){ |
| 36 |
value = parseInt(value); |
| 37 |
chart1a.getAxis("y").opt.rotation = value; |
| 38 |
chart1a.dirty = true; |
| 39 |
chart1a.setDir("rtl").render(); |
| 40 |
chart1b.getAxis("y").opt.rotation = value; |
| 41 |
chart1b.dirty = true; |
| 42 |
chart1b.setDir("rtl").render(); |
| 43 |
} |
| 44 |
require(["dojo/ready", "dojox/charting/Chart", "dojox/charting/axis2d/Default", |
| 45 |
"dojox/charting/plot2d/Markers", "dojox/charting/action2d/MouseZoomAndPan", "dojox/charting/Theme"], |
| 46 |
function(ready, Chart, Default, Markers, |
| 47 |
MouseZoomAndPan, Theme){ |
| 48 |
ready(function(){ |
| 49 |
|
| 50 |
var myLabelFunc = function(text, value){ |
| 51 |
return text+" make it even longer"; |
| 52 |
}; |
| 53 |
chart1a = new Chart("test1a"). |
| 54 |
addAxis("x", {fixLower: "major", fixUpper: "major", natural: true, includeZero: true, font: "14px helvetica", |
| 55 |
minorTickStep: 0.5, labelFunc: myLabelFunc, rotation: 30}). |
| 56 |
addAxis("y", {vertical: true, fixLower: "major", fixUpper: "major", natural: true, includeZero: true, labelFunc: myLabelFunc}). |
| 57 |
addPlot("default", {type: Markers}). |
| 58 |
addSeries("Series A", [{x: 1, y: 1}, {x: 2, y: 2}, {x: 3, y: 1}]). |
| 59 |
addSeries("Series B", [{x: 3, y: 2}, {x: 4, y: 3}, {x: 5, y: 2}]). |
| 60 |
addSeries("Series C", [{x: 5, y: 3}, {x: 6, y: 4}, {x: 7, y: 3}]). |
| 61 |
setDir("rtl").render(); |
| 62 |
new MouseZoomAndPan(chart1a); |
| 63 |
|
| 64 |
chart1b = new Chart("test1b"). |
| 65 |
addAxis("x", {fixLower: "major", fixUpper: "major", natural: true, includeZero: true, font: "14px helvetica", |
| 66 |
minorTickStep: 0.5, labelFunc: myLabelFunc, rotation: 30, leftBottom: false}). |
| 67 |
addAxis("y", {vertical: true, fixLower: "major", fixUpper: "major", natural: true, includeZero: true, labelFunc: myLabelFunc, leftBottom: false}). |
| 68 |
addPlot("default", {type: Markers}). |
| 69 |
addSeries("Series A", [{x: 1, y: 1}, {x: 2, y: 2}, {x: 3, y: 1}]). |
| 70 |
addSeries("Series B", [{x: 3, y: 2}, {x: 4, y: 3}, {x: 5, y: 2}]). |
| 71 |
addSeries("Series C", [{x: 5, y: 3}, {x: 6, y: 4}, {x: 7, y: 3}]). |
| 72 |
setDir("rtl").render(); |
| 73 |
new MouseZoomAndPan(chart1b); |
| 74 |
|
| 75 |
var chart2 = new Chart("test2"). |
| 76 |
addAxis("x", {fixLower: "major", fixUpper: "major", natural: true, includeZero: true, font: "14px helvetica", |
| 77 |
majorTickStep: 2, minorTickStep: 1, |
| 78 |
labels: [ {value: 0, text:"this is a very very long label"}, |
| 79 |
{ value: 1, text:"sm"}, |
| 80 |
{ value: 2, text:"short" }, |
| 81 |
{ value: 3, text: "minor" }, |
| 82 |
{ value: 4, text:"la" }, |
| 83 |
{ value: 5, text: "label" }, |
| 84 |
{ value: 6, text: "el" } |
| 85 |
]}). |
| 86 |
addAxis("y", {vertical: true, fixLower: "major", fixUpper: "major", natural: true, includeZero: true}). |
| 87 |
addPlot("default", {type: Markers}). |
| 88 |
addSeries("Series A", [{x: 0, y: 1}, {x: 2, y: 2}, {x: 4, y: 1}]). |
| 89 |
addSeries("Series B", [{x: 2, y: 2}, {x: 4, y: 3}, {x: 6, y: 2}]). |
| 90 |
addSeries("Series C", [{x: 4, y: 3}, {x: 6, y: 4}, {x: 8, y: 3}]). |
| 91 |
setDir("rtl").render(); |
| 92 |
new MouseZoomAndPan(chart2); |
| 93 |
|
| 94 |
|
| 95 |
var chart3 = new Chart("test3"). |
| 96 |
addAxis("x", {fixLower: "major", fixUpper: "major", natural: true, includeZero: true, font: "14px helvetica", |
| 97 |
majorTickStep: 0.5, minorTickStep: 0.1 }). |
| 98 |
addAxis("y", {vertical: true, fixLower: "major", fixUpper: "major", natural: true, includeZero: true}). |
| 99 |
addPlot("default", {type: Markers}). |
| 100 |
addSeries("Series A", [{x: 1, y: 1}, {x: 2, y: 2}, {x: 3, y: 1}]). |
| 101 |
addSeries("Series B", [{x: 5, y: 2}, {x: 6, y: 3}, {x: 7, y: 2}]). |
| 102 |
addSeries("Series C", [{x: 9, y: 3}, {x: 10, y: 4}, {x: 11, y: 3}]). |
| 103 |
setDir("rtl").render(); |
| 104 |
new MouseZoomAndPan(chart3); |
| 105 |
}); |
| 106 |
}); |
| 107 |
</script> |
| 108 |
</head> |
| 109 |
<body> |
| 110 |
<h1>Testing Axes drop labels</h1> |
| 111 |
<p>1: Axes with rotation & labelFunc</p> |
| 112 |
X Axis Label Rotation: <input onchange="rotationXChanged(this.value)" value="30"/> |
| 113 |
Y Axis Label Rotation: <input onchange="rotationYChanged(this.value)" value="0"/> |
| 114 |
<div id="test1a" style="width: 600px; height: 400px;"></div> |
| 115 |
<div id="test1b" style="width: 600px; height: 400px;"></div> |
| 116 |
<p>2: Axes with labels array.</p> |
| 117 |
<div id="test2" style="width: 600px; height: 200px;"></div> |
| 118 |
<p>3: Numeric axis.</p> |
| 119 |
<div id="test3" style="width: 320px; height: 180px;"></div> |
| 120 |
<p>That's all Folks!</p> |
| 121 |
</body> |
| 122 |
</html> |