emdagon / meteor-c3js Goto Github PK
View Code? Open in Web Editor NEWC3js Charts for Meteor
License: MIT License
C3js Charts for Meteor
License: MIT License
Trying a very basic c3 example:
Template.MyPage.rendered = function () {
var chart = c3.generate({
bindto: this.find('#myGraph'),
data: {
columns: [
['data1', 30, 200, 100, 400, 150, 250],
['data2', 50, 20, 10, 40, 15, 25]
]
}
});
};
Alas, I am getting an exception like:
Exception from Tracker afterFlush function: Cannot read property 'scale' of undefined
TypeError: Cannot read property 'scale' of undefined
at ChartInternal.c3_chart_internal_fn.generateColor (http://localhost:3000/packages/emdagon_c3js.js?94cafaaee63d158139e3382ec66301b206705d92:5477:101)
at ChartInternal.c3_chart_internal_fn.initParams (http://localhost:3000/packages/emdagon_c3js.js?94cafaaee63d158139e3382ec66301b206705d92:125:23)
at ChartInternal.c3_chart_internal_fn.init (http://localhost:3000/packages/emdagon_c3js.js?94cafaaee63d158139e3382ec66301b206705d92:84:12)
at new Chart (http://localhost:3000/packages/emdagon_c3js.js?94cafaaee63d158139e3382ec66301b206705d92:44:12)
at Object.c3.generate (http://localhost:3000/packages/emdagon_c3js.js?94cafaaee63d158139e3382ec66301b206705d92:68:16)
I trapped the issue in the debugger and I can see that d3 is undefined, so the following code is running into issues:
c3_chart_internal_fn.generateColor = function () { // 5443
var $$ = this, config = $$.config, d3 = $$.d3, // 5444
colors = config.data_colors, // 5445
pattern = notEmpty(config.color_pattern) ? config.color_pattern : d3.scale.category10().range(), // 5446
callback = config.data_color, // 5447
ids = []; // 5448
Note that c3 is defined:
Object {version: "0.4.9", generate: function, chart: Object}
I also confirmed that d3js is included before c3:
<script type="text/javascript" src="/packages/d3js_d3.js?143669b7a95b3f649beda008ede04424ece7be4e"></script>
<script type="text/javascript" src="/packages/emdagon_c3js.js?94cafaaee63d158139e3382ec66301b206705d92"></script>
So, why is d3 not defined?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.