| 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 with Date Labels</title> |
| 19 |
<style type="text/css"> |
| 20 |
@import "../../../dojo/resources/dojo.css"; |
| 21 |
@import "../../../dijit/tests/css/dijitTests.css"; |
| 22 |
@import "../../../dijit/themes/claro/claro.css"; |
| 23 |
</style> |
| 24 |
</head> |
| 25 |
<body class="claro"> |
| 26 |
<div id="simplechart" style="width: 600px; height: 200px;"></div> |
| 27 |
<script src='../../../dojo/dojo.js' data-dojo-config="async:1, isDebug:1"></script> |
| 28 |
<script> |
| 29 |
require([ |
| 30 |
"dojo/date", |
| 31 |
"dojo/date/locale", |
| 32 |
"dojox/charting/Chart", |
| 33 |
"dojox/charting/themes/Claro", |
| 34 |
"dojox/charting/plot2d/Lines", |
| 35 |
"dojox/charting/axis2d/Default", |
| 36 |
"dojo/domReady!" |
| 37 |
], function (date, locale, Chart, Claro) { |
| 38 |
|
| 39 |
function makeLabel(index){ |
| 40 |
var idx = index - 1; |
| 41 |
var d = date.add(new Date(), 'month', idx); |
| 42 |
return locale.format(d, {datePattern:'MM-dd-yyyy', selector:'date'}); |
| 43 |
} |
| 44 |
|
| 45 |
var chart = new Chart("simplechart"); |
| 46 |
|
| 47 |
chart.setTheme(Claro); |
| 48 |
chart.addPlot("myPlot", {type: "Lines"}); |
| 49 |
chart.addAxis("x", {labelFunc:makeLabel, minorTicks:false}); |
| 50 |
chart.addAxis("y", {vertical: true, leftBottom: true, includeZero:true}); |
| 51 |
|
| 52 |
chart.addSeries("Series 1", [2, 2, 2, 3, 4, 5, 5, 7]); |
| 53 |
|
| 54 |
chart.render(); |
| 55 |
}); |
| 56 |
</script> |
| 57 |
</body> |
| 58 |
</html> |