Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I don't think you have to modify the Dojo code. In Enyo, you have to tell the framework where it has to look for included JS files. Yo do so editing the depends.js file.</p> <p>The index.html:</p> <pre><code> &lt;!doctype html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;Canvas Demo&lt;/title&gt; &lt;script src="../../../../1.0/framework/enyo.js" type="text/javascript"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;script type="text/javascript"&gt; new enyo.Canon.graphs2().renderInto(document.body); &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>and depends.js:</p> <pre><code> enyo.depends( "lib/dojo/dojo.js" , "source/charts1.js" ); </code></pre> <p>You'll have to copy everything Dojo needs to work (dojo, dojox, dijit) into lib, and check enyo paths.</p> <p>I get a Dojo error when creating the new Chart2D object, and I'm not a Dojo expert to fix this. It's in the line:</p> <pre><code> var chart1 = new dojox.charting.Chart2D("simplechart"); </code></pre> <p>I've modified your code:</p> <pre><code>enyo.kind({ name: "enyo.Canon.graphs2", kind: enyo.Control, components: [ {kind: "PageHeader", content: "bargraph"}, //{style: "padding: 10px", content: "Note: In the browser, you can press ctrl-~ to display the app menu."}, {kind: "Button", caption: "display graph", onclick: "displayGraph", flex: 1}, ], displayGraph: function() { dojo.require('dojox.charting.Chart2D'); dojo.require('dojox.charting.widget.Chart2D'); dojo.require('dojox.charting.themes.PlotKit.green'); /* JSON information */ var json = { January: [12999,14487,19803,15965,17290], February: [14487,12999,15965,17290,19803], March: [15965,17290,19803,12999,14487] }; /* build pie chart data */ var chartData = []; dojo.forEach(json['January'],function(item,i) { chartData.push({ x: i, y: json['January'][i] }); }); /* resources are ready... */ dojo.ready(function() { //create / swap data var barData = []; dojo.forEach(chartData,function(item) { barData.push({ x: item['y'], y: item['x'] }); }); var chart1 = new dojox.charting.Chart2D("simplechart"); // HERE IS THE PROBLEM chart1.setTheme(dojox.charting.themes.PlotKit.green); chart1.addAxis('x', { fixUpper: 'major', includeZero: false, min:0, max:6 }); chart1.addAxis('y', { vertical: true, fixLower: 'major', fixUpper: 'major' }); chart1.addPlot('default', {type: 'Columns', gap:5 }); chart1.addSeries('Visits For February', chartData, {}); var anim4b = new dojox.charting.action2d.Tooltip(chart1, 'default'); var anim4c = new dojox.charting.action2d.Shake(chart1,'default'); chart1.render(); // var legend4 = new dojox.charting.widget.Legend({ chart: chart1 }, 'legend3'); }); </code></pre> <p>} });</p> <p>The object doesn't get instantiated. Got null pointer :-(</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload