About
dojo 1) is a framework based around the AMD module and specification that provides:
- an module loader 2) (adoption of bdLoad) based on the AMD specification (ie equivalent to RequireJs)
- and a wide range of AMD module.
Example
Charting With Dojo
Example: 3)
- Add the dojo library in your HTML page
<script src="https://ajax.googleapis.com/ajax/libs/dojo/1.13.0/dojo/dojo.js"></script>
- The html where the graph will be rendered
<div id="chartOne"></div>
- Run
require(["dojox/charting/Chart", "dojox/charting/axis2d/Default", "dojox/charting/plot2d/StackedAreas", "dojox/charting/themes/Wetland" , "dojo/ready"],
function(Chart, Default, StackedAreas, Wetland, ready){
ready(function(){
var c = new Chart("chartOne");
c.addPlot("default", {type: StackedAreas, tension:3})
.addAxis("x", {fixLower: "major", fixUpper: "major"})
.addAxis("y", {vertical: true, fixLower: "major", fixUpper: "major", min: 0})
.setTheme(Wetland)
.addSeries("Series A", [1, 2, 0.5, 1.5, 1, 2.8, 0.4])
.addSeries("Series B", [2.6, 1.8, 2, 1, 1.4, 0.7, 2])
.addSeries("Series C", [6.3, 1.8, 3, 0.5, 4.4, 2.7, 2])
.render();
});
});
Loading and using a third party library: bower.js to print your browser
- Add the dojo library in your HTML page
<script src="https://ajax.googleapis.com/ajax/libs/dojo/1.13.0/dojo/dojo.js"></script>
- Require
require(['https://cdnjs.cloudflare.com/ajax/libs/bowser/2.11.0/bundled.min.js'], function(bowser) {
const browser = bowser.getParser(window.navigator.userAgent);
console.log(`Your browser name is "${browser.getBrowserName()}"`);
});