| 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>Chart2D Title</title> |
| 19 |
<style type="text/css"> |
| 20 |
@import "../../../dojo/resources/dojo.css"; |
| 21 |
@import "../../../dijit/tests/css/dijitTests.css"; |
| 22 |
@import "../../../dijit/themes/tundra/tundra.css"; |
| 23 |
</style> |
| 24 |
<script type="text/javascript" src="../../../dojo/dojo.js" data-dojo-config="isDebug: true, parseOnLoad: true"></script> |
| 25 |
<script type="text/javascript"> |
| 26 |
|
| 27 |
dojo.require("dojox.charting.Chart"); |
| 28 |
dojo.require("dojox.charting.axis2d.Default"); |
| 29 |
dojo.require("dojox.charting.plot2d.Lines"); |
| 30 |
dojo.require("dojox.charting.plot2d.Columns"); |
| 31 |
dojo.require("dojox.charting.themes.PlotKit.blue"); |
| 32 |
dojo.require("dojox.charting.themes.PlotKit.cyan"); |
| 33 |
dojo.require("dojox.charting.themes.PlotKit.green"); |
| 34 |
dojo.require("dojox.charting.themes.PlotKit.orange"); |
| 35 |
dojo.require("dojox.charting.themes.PlotKit.purple"); |
| 36 |
dojo.require("dojox.charting.themes.PlotKit.red"); |
| 37 |
dojo.require("dijit.form.Button"); |
| 38 |
dojo.require("dijit.form.NumberSpinner"); |
| 39 |
dojo.require("dojo.parser"); |
| 40 |
|
| 41 |
var chart1; |
| 42 |
|
| 43 |
updateTitleGap = function(){ |
| 44 |
chart1.titleGap = dijit.byId("titleGap").get("value"); |
| 45 |
chart1.fullRender(); |
| 46 |
} |
| 47 |
|
| 48 |
makeObjects = function(){ |
| 49 |
chart1 = new dojox.charting.Chart("test1", {title: "Production(ton)"}). |
| 50 |
addAxis("x", { |
| 51 |
includeZero: true, natural: true, fixLower: "major", fixUpper: "major", |
| 52 |
labels: [ |
| 53 |
{value: 0, text: ""},{value: 1, text: "Jan"},{value: 2, text: "Feb"}, |
| 54 |
{value: 3, text: "Mar"},{value: 4, text: "Aprl"},{value: 5, text: "May"} |
| 55 |
] |
| 56 |
}). |
| 57 |
addAxis("y", { |
| 58 |
vertical: true, includeZero: true, natural: true, fixLower: "major", fixUpper: "major", majorTickStep: 2 |
| 59 |
}). |
| 60 |
addPlot("default", {type: "Columns"}). |
| 61 |
addSeries("Series A", [2, 6, 14, 3, 3], {stroke: {color: "orange"}, fill: "yellow"}). |
| 62 |
addSeries("Series B", [2, 8, 8, 8, 6], {stroke: {color: "green"}, fill: "lightgreen"}). |
| 63 |
render(); |
| 64 |
|
| 65 |
var chart2 = new dojox.charting.Chart("test2", { |
| 66 |
title: "Production(Quantity)", |
| 67 |
titlePos: "bottom", |
| 68 |
titleGap: 25, |
| 69 |
titleFont: "normal normal normal 15pt Arial", |
| 70 |
titleFontColor: "orange" |
| 71 |
}). |
| 72 |
addAxis("x", { |
| 73 |
includeZero: true, natural: true, fixLower: "major", fixUpper: "major", |
| 74 |
labels: [ |
| 75 |
{value: 0, text: ""},{value: 1, text: "Jan"},{value: 2, text: "Feb"}, |
| 76 |
{value: 3, text: "Mar"},{value: 4, text: "Aprl"},{value: 5, text: "May"} |
| 77 |
] |
| 78 |
}). |
| 79 |
addAxis("y", { |
| 80 |
vertical: true, includeZero: true, natural: true, fixLower: "major", fixUpper: "major", majorTickStep: 200 |
| 81 |
}). |
| 82 |
addPlot("default", {type: "Lines"}). |
| 83 |
addSeries("Series A", [400, 800, 200, 600, 600], {stroke: {color: "red"}, fill: "lightpink"}). |
| 84 |
addSeries("Series B", [200, 300, 500, 700, 800], {stroke: {color: "blue"}, fill: "lightblue"}). |
| 85 |
render(); |
| 86 |
|
| 87 |
var chart3 = new dojox.charting.Chart("test3", { |
| 88 |
title: "Production(Quantity)", |
| 89 |
titleFont: "normal normal normal 15pt Arial", |
| 90 |
titleFontColor: "orange", |
| 91 |
titleAlign: "edge" |
| 92 |
}). |
| 93 |
addAxis("x", { |
| 94 |
includeZero: true, natural: true, fixLower: "major", fixUpper: "major", |
| 95 |
labels: [ |
| 96 |
{value: 0, text: ""},{value: 1, text: "Jan"},{value: 2, text: "Feb"}, |
| 97 |
{value: 3, text: "Mar"},{value: 4, text: "Aprl"},{value: 5, text: "May"} |
| 98 |
] |
| 99 |
}). |
| 100 |
addAxis("y", { |
| 101 |
vertical: true, includeZero: true, natural: true, fixLower: "major", fixUpper: "major", majorTickStep: 200 |
| 102 |
}). |
| 103 |
addPlot("default", {type: "Lines"}). |
| 104 |
addSeries("Series A", [400, 800, 200, 600, 600], {stroke: {color: "red"}, fill: "lightpink"}). |
| 105 |
addSeries("Series B", [200, 300, 500, 700, 800], {stroke: {color: "blue"}, fill: "lightblue"}). |
| 106 |
render(); |
| 107 |
var chart4 = new dojox.charting.Chart("test4", { |
| 108 |
title: "Production(Quantity)", |
| 109 |
titleFont: "normal normal normal 15pt Arial", |
| 110 |
titleFontColor: "orange", |
| 111 |
titleAlign: "left" |
| 112 |
}). |
| 113 |
addAxis("x", { |
| 114 |
includeZero: true, natural: true, fixLower: "major", fixUpper: "major", |
| 115 |
labels: [ |
| 116 |
{value: 0, text: ""},{value: 1, text: "Jan"},{value: 2, text: "Feb"}, |
| 117 |
{value: 3, text: "Mar"},{value: 4, text: "Aprl"},{value: 5, text: "May"} |
| 118 |
] |
| 119 |
}). |
| 120 |
addAxis("y", { |
| 121 |
vertical: true, includeZero: true, natural: true, fixLower: "major", fixUpper: "major", majorTickStep: 200 |
| 122 |
}). |
| 123 |
addPlot("default", {type: "Lines"}). |
| 124 |
addSeries("Series A", [400, 800, 200, 600, 600], {stroke: {color: "red"}, fill: "lightpink"}). |
| 125 |
addSeries("Series B", [200, 300, 500, 700, 800], {stroke: {color: "blue"}, fill: "lightblue"}). |
| 126 |
render(); |
| 127 |
var chart5 = new dojox.charting.Chart("test5", { |
| 128 |
title: "Production(Quantity)", |
| 129 |
titleFont: "normal normal normal 15pt Arial", |
| 130 |
titleFontColor: "orange", |
| 131 |
titleAlign: "right" |
| 132 |
}). |
| 133 |
addAxis("x", { |
| 134 |
includeZero: true, natural: true, fixLower: "major", fixUpper: "major", |
| 135 |
labels: [ |
| 136 |
{value: 0, text: ""},{value: 1, text: "Jan"},{value: 2, text: "Feb"}, |
| 137 |
{value: 3, text: "Mar"},{value: 4, text: "Aprl"},{value: 5, text: "May"} |
| 138 |
] |
| 139 |
}). |
| 140 |
addAxis("y", { |
| 141 |
vertical: true, includeZero: true, natural: true, fixLower: "major", fixUpper: "major", majorTickStep: 200 |
| 142 |
}). |
| 143 |
addPlot("default", {type: "Lines"}). |
| 144 |
addSeries("Series A", [400, 800, 200, 600, 600], {stroke: {color: "red"}, fill: "lightpink"}). |
| 145 |
addSeries("Series B", [200, 300, 500, 700, 800], {stroke: {color: "blue"}, fill: "lightblue"}). |
| 146 |
render(); |
| 147 |
}; |
| 148 |
|
| 149 |
dojo.addOnLoad(makeObjects); |
| 150 |
|
| 151 |
</script> |
| 152 |
</head> |
| 153 |
<body class="tundra"> |
| 154 |
<h1>Chart2D Title</h1> |
| 155 |
<p>Column chart with chart title</p> |
| 156 |
<p> |
| 157 |
Title Gap: |
| 158 |
<input dojoType="dijit.form.NumberSpinner" id="titleGap" value="20" constraints="{min: 0, max: 100, fractional: false}" style="width: 8em;"> |
| 159 |
|
| 160 |
<button dojoType="dijit.form.Button" onClick="updateTitleGap()">Apply</button> |
| 161 |
</p> |
| 162 |
<div id="test1" style="width: 400px; height: 300px;"></div> |
| 163 |
<p>Line chart with customized chart title</p> |
| 164 |
<div id="test2" style="width: 400px; height: 300px;"></div> |
| 165 |
<p>Line chart with edge aligned title</p> |
| 166 |
<div id="test3" style="width: 400px; height: 300px;"></div> |
| 167 |
<p>Line chart with left aligned title</p> |
| 168 |
<div id="test4" style="width: 400px; height: 300px;"></div> |
| 169 |
<p>Line chart with right aligned title</p> |
| 170 |
<div id="test5" style="width: 400px; height: 300px;"></div> |
| 171 |
|
| 172 |
</body> |
| 173 |
</html> |