I get an Uncaught ReferenceError for generateChart.
I've defined generateChart in Chart.js which is referenced in require.config.js.
I'm new to javascript and require so this is a newbee question.
Here is my code:
main html file:
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<body>
<p id="example">
<script src="js/require.config.js"></script>
<script data-main="js/config.js" src="js/lib/require.js"></script>
</body>
require.config.js
var require = {
paths: {
'd3': 'lib/d3',
'Chart' : 'Chart'
}
};
config.js which contains the main entry point and the unreferenced call to generateChart
define([
'd3',
'Chart'
], function (d3, Chart) {
'use strict';
d3.csv("sp500.csv", function(data) {
d3.select("#example")
.datum(data)
.call(generateChart());
});
});
And Chart.js where I define generateChart
define([
'd3'
], function (d3) {
'use strict';
generateChart = function() {
};
});