I'm trying to include Dojo charts in a titanium project.
I've tried to load a webview with Dojo declarations and then load the webview in the app. But I can't make it working. I've included in my project a folder (libs_dojo) with:
- dojo.js
- domReady.js
- dojox/charting/Chart
- dojox/charting/plot2d/Lines
- dojox/charting/axis2d/Default
This is the simple html I'm using:
<html>
<head>
<title>Chart</title>
</head>
<body>
<div id="simplechart" style="width: 250px; height: 150px;"></div>
<script src='libs_dojo/dojo.js' data-dojo-config="async:true"></script>
<script>
require([
"libs_dojo/dojox/charting/Chart",
"libs_dojo/dojox/charting/plot2d/Lines",
"libs_dojo/dojox/charting/axis2d/Default",
"libs_dojo/domReady!"
],
function (Chart) {
var chart = new Chart("simplechart");
chart.addPlot("default", {type: "Lines"});
chart.addAxis("x");
chart.addAxis("y", {vertical: true});
chart.addSeries("Series 1", [1, 2, 2, 3, 4, 5, 5, 7]);
chart.render();
});
</script>
</body>
</html>
When I tried it, I found a lot of "Error loading xxx/libs_dojo/_base/lang.js or libs_dojo/_base/array.js..."
How does dojo require work? Can I do it otherwise? programmatically? Do you know what the problem could be?
Thanks in advance!