| 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 -- Sparklines Edition</title> |
| 18 |
<style type="text/css"> |
| 19 |
@import "../../../dojo/resources/dojo.css"; |
| 20 |
@import "../../../dijit/tests/css/dijitTests.css"; |
| 21 |
.volume { color: #666666; } |
| 22 |
|
| 23 |
.label { |
| 24 |
text-align: right; |
| 25 |
line-height: 1.5em; |
| 26 |
} |
| 27 |
</style> |
| 28 |
<script type="text/javascript" src="../../../dojo/dojo.js" |
| 29 |
data-dojo-config="isDebug: false, parseOnLoad: true"></script> |
| 30 |
<script type="text/javascript"> |
| 31 |
dojo.require("dojox.charting.plot2d.Lines"); |
| 32 |
dojo.require("dojox.charting.plot2d.Areas"); |
| 33 |
dojo.require("dojox.charting.widget.Sparkline"); |
| 34 |
dojo.require("dojox.charting.themes.Tufte"); |
| 35 |
dojo.require("dojox.data.HtmlStore"); |
| 36 |
dojo.require("dojox.data.CsvStore"); |
| 37 |
dojo.require("dojo.parser"); |
| 38 |
</script> |
| 39 |
|
| 40 |
</head> |
| 41 |
<body> |
| 42 |
<h1>Chart 2D</h1> |
| 43 |
<p>Sparkline-style charts using dojox.charting</p> |
| 44 |
<p><em>This is a particularly brutal example with <strong>lots and lots</strong> of data. |
| 45 |
It may cause laggyness in lesser browsers.</em></p> |
| 46 |
|
| 47 |
<div dojoType="dojox.data.HtmlStore" dataId="tableExample" data-dojo-id="tableStore"></div> |
| 48 |
<table id="tableExample" style="display: none;"> |
| 49 |
<thead> |
| 50 |
<tr><th>value</th></tr> |
| 51 |
</thead> |
| 52 |
<tbody> |
| 53 |
<tr><td>6.3</td></tr> |
| 54 |
<tr><td>1.8</td></tr> |
| 55 |
<tr><td>3 </td></tr> |
| 56 |
<tr><td>0.5</td></tr> |
| 57 |
<tr><td>4.4</td></tr> |
| 58 |
<tr><td>2.7</td></tr> |
| 59 |
<tr><td>2 </td></tr> |
| 60 |
</tbody> |
| 61 |
</table> |
| 62 |
|
| 63 |
<table cellpadding="0" cellspacing="3" border="0"> |
| 64 |
<tr> |
| 65 |
<td class="label"> |
| 66 |
Simple Sparkline: |
| 67 |
</td> |
| 68 |
<td> |
| 69 |
<div dojoType="dojox.charting.widget.Chart" |
| 70 |
theme="dojox.charting.themes.Tufte" |
| 71 |
margins="{ l: 0, r: 0, t: 0, b: 0 }" |
| 72 |
style="width: 100px; height: 15px;"> |
| 73 |
<div class="plot" name="default" type="Lines"></div> |
| 74 |
<div class="series" name="Series A" store="tableStore" valueFn="Number(x)"></div> |
| 75 |
</div> |
| 76 |
</td> |
| 77 |
<td> |
| 78 |
7 arbitrary data points |
| 79 |
</td> |
| 80 |
</tr> |
| 81 |
<tr> |
| 82 |
<td class="label"> |
| 83 |
<a href="http://finance.google.com/finance?q=Google">Google </a> Closing Price & <span class="volume">Volume</span>: |
| 84 |
</td> |
| 85 |
<td> |
| 86 |
|
| 87 |
<div dojoType="dojox.data.CsvStore" data-dojo-id="googStore" |
| 88 |
url="data/goog_prices.csv"></div> |
| 89 |
<div dojoType="dojox.charting.widget.Chart" |
| 90 |
theme="dojox.charting.themes.Tufte" |
| 91 |
margins="{ l: 0, r: 0, t: 0, b: 0 }" |
| 92 |
style="width: 100px; height: 15px;"> |
| 93 |
<div class="plot" name="default" type="Lines"></div> |
| 94 |
<div class="series" |
| 95 |
name="Closing Price" |
| 96 |
plot="default" |
| 97 |
store="googStore" |
| 98 |
count="Infinity" |
| 99 |
field="Close" |
| 100 |
sort="[{ attribute: 'Date', descending: false }]" |
| 101 |
valueFn="Number(x)"></div> |
| 102 |
<div class="plot" name="volume" type="Areas"></div> |
| 103 |
<div class="series" |
| 104 |
name="Volume" |
| 105 |
plot="volume" |
| 106 |
store="googStore" |
| 107 |
count="Infinity" |
| 108 |
field="Volume" |
| 109 |
sort="[{ attribute: 'Date', descending: false }]" |
| 110 |
stroke="{ color: '#666666', width: 0 }" |
| 111 |
fill="'#b3b3b3'" |
| 112 |
valueFn="Number(x/100000)"></div> |
| 113 |
</div> |
| 114 |
|
| 115 |
</td> |
| 116 |
<td> |
| 117 |
~1400 data points, all trading days since Jan '05 |
| 118 |
</td> |
| 119 |
</tr> |
| 120 |
<tr> |
| 121 |
<td class="label"> |
| 122 |
<a href="http://finance.google.com/finance?q=Yahoo">Yahoo</a> Closing Price & <span class="volume">Volume</span>: |
| 123 |
</td> |
| 124 |
<td> |
| 125 |
|
| 126 |
<div dojoType="dojox.data.CsvStore" data-dojo-id="yahooStore" |
| 127 |
url="data/yahoo_prices.csv"></div> |
| 128 |
<div dojoType="dojox.charting.widget.Chart" |
| 129 |
theme="dojox.charting.themes.Tufte" |
| 130 |
margins="{ l: 0, r: 0, t: 0, b: 0 }" |
| 131 |
style="width: 100px; height: 15px;"> |
| 132 |
<div class="plot" name="default" type="Lines"></div> |
| 133 |
<div class="series" |
| 134 |
name="Closing Price" |
| 135 |
plot="default" |
| 136 |
store="yahooStore" |
| 137 |
count="Infinity" |
| 138 |
field="Close" |
| 139 |
sort="[{ attribute: 'Date', descending: false }]" |
| 140 |
valueFn="Number(x)"></div> |
| 141 |
<div class="plot" name="volume" type="Areas"></div> |
| 142 |
<div class="series" |
| 143 |
name="Volume" |
| 144 |
plot="volume" |
| 145 |
store="yahooStore" |
| 146 |
count="Infinity" |
| 147 |
field="Volume" |
| 148 |
sort="[{ attribute: 'Date', descending: false }]" |
| 149 |
stroke="{ color: '#666666', width: 0 }" |
| 150 |
fill="'#b3b3b3'" |
| 151 |
valueFn="Number(x/100000)"></div> |
| 152 |
</div> |
| 153 |
|
| 154 |
</td> |
| 155 |
<td> |
| 156 |
</td> |
| 157 |
</tr> |
| 158 |
<tr> |
| 159 |
<td class="label"> |
| 160 |
<a href="http://finance.google.com/finance?q=Microsoft">Microsoft</a> Closing Price & <span class="volume">Volume</span>: |
| 161 |
</td> |
| 162 |
<td> |
| 163 |
<div dojoType="dojox.data.CsvStore" data-dojo-id="msftStore" |
| 164 |
url="data/msft_prices.csv"></div> |
| 165 |
<div dojoType="dojox.charting.widget.Chart" |
| 166 |
theme="dojox.charting.themes.Tufte" |
| 167 |
margins="{ l: 0, r: 0, t: 0, b: 0 }" |
| 168 |
style="width: 100px; height: 15px;"> |
| 169 |
<div class="plot" name="default" type="Lines"></div> |
| 170 |
<div class="series" |
| 171 |
name="Closing Price" |
| 172 |
plot="default" |
| 173 |
store="msftStore" |
| 174 |
count="Infinity" |
| 175 |
field="Close" |
| 176 |
sort="[{ attribute: 'Date', descending: false }]" |
| 177 |
valueFn="Number(x)"></div> |
| 178 |
<div class="plot" name="volume" type="Areas"></div> |
| 179 |
<div class="series" |
| 180 |
name="Volume" |
| 181 |
plot="volume" |
| 182 |
store="msftStore" |
| 183 |
count="Infinity" |
| 184 |
field="Volume" |
| 185 |
sort="[{ attribute: 'Date', descending: false }]" |
| 186 |
stroke="{ color: '#666666', width: 0 }" |
| 187 |
fill="'#b3b3b3'" |
| 188 |
valueFn="Number(x/100000)"></div> |
| 189 |
</div> |
| 190 |
|
| 191 |
</td> |
| 192 |
<td> |
| 193 |
</td> |
| 194 |
</tr> |
| 195 |
<tr> |
| 196 |
<td class="label"> |
| 197 |
<a href="http://finance.google.com/finance?q=Microsoft">Microsoft</a> Closing Price: |
| 198 |
</td> |
| 199 |
<td> |
| 200 |
<div dojoType="dojox.charting.widget.Sparkline" |
| 201 |
style="width: 100px; height: 15px;" |
| 202 |
store="msftStore" |
| 203 |
field="Close" |
| 204 |
count="100" |
| 205 |
sort="[{ attribute: 'Date', descending: false }]" |
| 206 |
valueFn="Number(x)" |
| 207 |
></div> |
| 208 |
</td> |
| 209 |
<td> |
| 210 |
100 points using Sparkline widget |
| 211 |
</td> |
| 212 |
</tr> |
| 213 |
|
| 214 |
</table> |
| 215 |
</body> |
| 216 |
</html> |