You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
129 lines
5.4 KiB
129 lines
5.4 KiB
<!--[if IE 7]> |
|
<!DOCTYPE> |
|
<html lang="en"> |
|
<head> |
|
<![endif]--> |
|
<!--[if IE 8]> |
|
<!DOCTYPE> |
|
<html lang="en"> |
|
<head> |
|
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"/> |
|
<![endif]--> |
|
<![if gte IE 9]> |
|
<!DOCTYPE HTML> |
|
<html lang="en"> |
|
<head> |
|
<![endif]> |
|
<title>Axis Zoom Control</title> |
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
|
<style type="text/css"> |
|
@import "../../../dojo/resources/dojo.css"; |
|
@import "../../../dijit/themes/tundra/tundra.css"; |
|
@import "../../../dijit/tests/css/dijitTests.css"; |
|
@import "../../form/resources/RangeSlider.css"; |
|
#hrXAxisSlider .dijitSliderProgressBar{ |
|
height: 12px; |
|
overflow: visible; |
|
margin-top: -5px; |
|
} |
|
</style> |
|
<script type="text/javascript" src="../../../dojo/dojo.js" data-dojo-config="isDebug: true, parseOnLoad: true"></script> |
|
<script type="text/javascript"> |
|
var chart1, zoomAxis; |
|
|
|
require(["dojo/dom", "dojo/ready", "dojox/charting/Chart", "dojox/charting/axis2d/Default", "dojox/charting/plot2d/Lines", |
|
"dojox/charting/plot2d/StackedAreas", "dojox/charting/plot2d/Grid", |
|
"dojox/charting/themes/PlotKit/orange", "dojox/charting/action2d/Tooltip", |
|
"dojox/charting/action2d/Magnify", "dojo/parser", "dojox/form/RangeSlider"], function(dom, ready, Chart, Default, Lines, StackedAreas, |
|
Grid, orange, Tooltip, Magnify){ |
|
zoomXAxis = function(){ |
|
chart1.zoomIn("x", arguments[0]); |
|
chart2.zoomIn("x", arguments[0]); |
|
dom.byId('minValue').value = arguments[0][0]; |
|
dom.byId('maxValue').value = arguments[0][1]; |
|
} |
|
ready(function(){ |
|
chart1 = new Chart("chart1"); |
|
chart1.setTheme(orange); |
|
chart1.addAxis("x", {fixLower: "minor", natural: true, stroke: "grey", |
|
majorTick: {stroke: "black", length: 4}, minorTick: {stroke: "gray", length: 2}}); |
|
chart1.addAxis("y", {vertical: true, min: 0, max: 100, majorTickStep: 5, minorTickStep: 1, stroke: "grey", |
|
majorTick: {stroke: "black", length: 4}, minorTick: {stroke: "gray", length: 2}}); |
|
chart1.addPlot("default", {type: Lines, markers: true}); |
|
chart1.addSeries("Series A", [ |
|
8, 7, 3, 2, 5, 7, 9, 10, 2, 10, |
|
14, 16, 18, 13, 16, 15, 20, 19, 15, 12, |
|
24, 20, 20, 26, 28, 26, 28, 29, 24, 29, |
|
31, 35, 37, 31, 35, 37, 37, 36, 31, 30, |
|
50, 49, 42, 46, 44, 40, 47, 43, 48, 47, |
|
51, 52, 52, 51, 54, 57, 58, 50, 54, 51, |
|
62, 68, 67, 62, 62, 65, 61, 66, 65, 62, |
|
74, 78, 78, 77, 74, 74, 72, 74, 70, 78, |
|
84, 83, 85, 86, 86, 89, 89, 85, 86, 86, |
|
98, 97, 93, 91, 92, 92, 99, 93, 94, 92 |
|
]); |
|
chart1.addPlot("grid", {type: Grid, hMinorLines:true}); |
|
new Tooltip(chart1, "default"); |
|
new Magnify(chart1,"default"); |
|
chart1.render(); |
|
chart2 = new Chart("chart2"); |
|
chart2.setTheme(orange); |
|
chart2.addAxis("x", {fixLower: "minor", natural: true, stroke: "grey", |
|
majorTick: {stroke: "black", length: 4}, minorTick: {stroke: "gray", length: 2}}); |
|
chart2.addAxis("y", {vertical: true, min: 0, max: 200, majorTickStep: 5, minorTickStep: 1, stroke: "grey", |
|
majorTick: {stroke: "black", length: 4}, minorTick: {stroke: "gray", length: 2}}); |
|
chart2.addPlot("default", {type: StackedAreas }); |
|
chart2.addSeries("Series A", [ |
|
8, 7, 3, 2, 5, 7, 9, 10, 2, 10, |
|
14, 16, 18, 13, 16, 15, 20, 19, 15, 12, |
|
24, 20, 20, 26, 28, 26, 28, 29, 24, 29, |
|
31, 35, 37, 31, 35, 37, 37, 36, 31, 30, |
|
50, 49, 42, 46, 44, 40, 47, 43, 48, 47, |
|
51, 52, 52, 51, 54, 57, 58, 50, 54, 51, |
|
62, 68, 67, 62, 62, 65, 61, 66, 65, 62, |
|
74, 78, 78, 77, 74, 74, 72, 74, 70, 78, |
|
84, 83, 85, 86, 86, 89, 89, 85, 86, 86, |
|
98, 97, 93, 91, 92, 92, 99, 93, 94, 92 |
|
]); |
|
chart2.addSeries("Series B", [ |
|
8, 7, 3, 2, 5, 7, 9, 10, 2, 10, |
|
14, 16, 18, 13, 16, 15, 20, 19, 15, 12, |
|
24, 20, 20, 26, 28, 26, 28, 29, 24, 29, |
|
31, 35, 37, 31, 35, 37, 37, 36, 31, 30, |
|
50, 49, 42, 46, 44, 40, 47, 43, 48, 47, |
|
51, 52, 52, 51, 54, 57, 58, 50, 54, 51, |
|
62, 68, 67, 62, 62, 65, 61, 66, 65, 62, |
|
74, 78, 78, 77, 74, 74, 72, 74, 70, 78, |
|
84, 83, 85, 86, 86, 89, 89, 85, 86, 86, |
|
98, 97, 93, 91, 92, 92, 99, 93, 94, 92 |
|
]); |
|
chart2.render(); |
|
}); |
|
}); |
|
</script> |
|
</head> |
|
<body class="tundra"> |
|
<h1>Axis Zoom Control</h1> |
|
Try to drag the slider endpoints and the bar to zoom X axis of the chart. |
|
<div style="margin:20px"> |
|
<div id="chart1" style="width: 800px; height: 400px;"></div> |
|
<div id="chart2" style="width: 800px; height: 400px;"></div> |
|
<div id="hrXAxisSlider" |
|
discreteValues="21" |
|
onChange="zoomXAxis" |
|
intermediateChanges="false" |
|
data-dojo-type="dojox.form.HorizontalRangeSlider" |
|
showButtons="false" |
|
style="width:748px;margin-left:40px" |
|
value="0,100"> |
|
<ol data-dojo-type="dijit/form/HorizontalRuleLabels" container="topDecoration" style="height:1.2em;font-size:75%;color:gray;" count="11"> |
|
<li>0</li><li>10</li><li>20</li><li>30</li><li>40</li><li>50</li><li>60</li><li>70</li><li>80</li><li>90</li><li>100</li> |
|
</ol> |
|
<div data-dojo-type="dijit/form/HorizontalRule" container="topDecoration" count=11 style="height:10px;"></div> |
|
</div> |
|
</div> |
|
<p>X Axis Lower Value: <input readonly id="minValue" size="10" value="0"/></p> |
|
<p>X Axis Upper Value: <input readonly id="maxValue" size="10" value="100"/></p> |
|
<p>That's all Folks!</p> |
|
</body> |
|
</html>
|
|
|