| 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 |
<title>Chart 2D</title> |
| 18 |
<style type="text/css"> |
| 19 |
@import "../../../dojo/resources/dojo.css"; |
| 20 |
@import "../../../dijit/tests/css/dijitTests.css"; |
| 21 |
</style> |
| 22 |
<script type="text/javascript" src="../../../dojo/dojo.js" data-dojo-config="isDebug: true, async: true"></script> |
| 23 |
<script type="text/javascript"> |
| 24 |
require([ |
| 25 |
"dojo/ready", |
| 26 |
"dojo/dom", |
| 27 |
"dojo/_base/Color", |
| 28 |
"dojox/charting/Chart", |
| 29 |
"dojox/charting/axis2d/Default", |
| 30 |
"dojox/charting/plot2d/Lines", |
| 31 |
"dojox/charting/plot2d/Grid"], |
| 32 |
function(ready, dom, Color, Chart, Axis, Lines, Grid){ |
| 33 |
ready(function(){ |
| 34 |
var chart = new Chart(dom.byId("chart")). |
| 35 |
addAxis("x", { fixLower: "minor", fixUpper: "minor", natural: true }). |
| 36 |
addAxis("y", { vertical: true, fixLower: "major", fixUpper: "major", includeZero: true }). |
| 37 |
addPlot("default", { type: Lines }). |
| 38 |
addPlot("grid", { type: Grid, renderOnAxis: false, majorVLine: { color: "green", width: 3 }, majorHLine: { color: "red", width: 3 } }). |
| 39 |
addSeries("Series A", [ 2, 1, 0.5, -1, -2 ] ). |
| 40 |
render(); |
| 41 |
var color = new Color({ r:246, g:249, b:253, a:0.8 }); |
| 42 |
var color2 = new Color({ r:146, g:149, b:153, a:0.8 }); |
| 43 |
var chart = new Chart(dom.byId("chartH")). |
| 44 |
addAxis("x", { fixLower: "minor", fixUpper: "minor", natural: true }). |
| 45 |
addAxis("y", { vertical: true, fixLower: "major", fixUpper: "major", includeZero: true }). |
| 46 |
addPlot("default", { type: Lines }). |
| 47 |
addPlot("grid", { type: Grid, renderOnAxis: false, majorVLine: { color: color, width: 1 }, hMajorLines: false, |
| 48 |
hFill: color, hAlternateFill: color2, hStripes: true }). |
| 49 |
addSeries("Series A", [ 2, 1, 0.5, -1, -2 ] ). |
| 50 |
render(); |
| 51 |
|
| 52 |
var chart = new Chart(dom.byId("chartV")). |
| 53 |
addAxis("x", { fixLower: "minor", fixUpper: "minor", natural: true }). |
| 54 |
addAxis("y", { vertical: true, fixLower: "major", fixUpper: "major", includeZero: true }). |
| 55 |
addPlot("default", { type: Lines }). |
| 56 |
addPlot("grid", { type: Grid, renderOnAxis: false, majorHLine: { color: color, width: 1 }, vMajorLines: false, vFill: color, vStripes: true }). |
| 57 |
addSeries("Series A", [ 2, 1, 0.5, -1, -2 ] ). |
| 58 |
render(); |
| 59 |
color = new Color({ r:246, g:249, b:253, a:0.3 }); |
| 60 |
var chart = new Chart(dom.byId("chartScot")). |
| 61 |
addAxis("x", { fixLower: "minor", fixUpper: "minor", minorTickStep: 0.2 }). |
| 62 |
addAxis("y", { vertical: true, fixLower: "major", fixUpper: "major", includeZero: true , minorTickStep: 0.2 }). |
| 63 |
addPlot("default", { type: Lines }). |
| 64 |
addPlot("grid", { type: Grid, renderOnAxis: false, hFill: color, vFill: color, hMajorLines: false, vMajorLines: false, hStripes: true, vStripes: true }). |
| 65 |
addSeries("Series A", [ 2, 1, 0.5, -1, -2 ] ). |
| 66 |
render(); |
| 67 |
}); |
| 68 |
}); |
| 69 |
</script> |
| 70 |
</head> |
| 71 |
<body> |
| 72 |
<h1>Grid</h1> |
| 73 |
<div id="chart" style="width:400px; height:300px"></div> |
| 74 |
<div id="chartH" style="width:400px; height:300px"></div> |
| 75 |
<div id="chartV" style="width:400px; height:300px"></div> |
| 76 |
<div id="chartScot" style="width:400px; height:300px"></div> |
| 77 |
</body> |
| 78 |
</html> |