Commit cb266c64 authored by Evgeny Bovykin's avatar Evgeny Bovykin

Fix problem with local d3

parent eccb9677
...@@ -92,7 +92,7 @@ module.exports = (grunt) -> ...@@ -92,7 +92,7 @@ module.exports = (grunt) ->
specs: 'spec/*-spec.js' specs: 'spec/*-spec.js'
helpers: 'spec/*-helper.js' helpers: 'spec/*-helper.js'
styles: 'c3.css' styles: 'c3.css'
vendor: 'https://rawgit.com/mbostock/d3/v3.5.0/d3.min.js' vendor: 'bower_components/d3/d3.js'
uglify: uglify:
c3: c3:
...@@ -111,4 +111,4 @@ module.exports = (grunt) -> ...@@ -111,4 +111,4 @@ module.exports = (grunt) ->
files: files:
'c3.css': 'src/scss/main.scss' 'c3.css': 'src/scss/main.scss'
grunt.registerTask 'default', ['concat', 'jshint', 'jasmine', 'sass', 'cssmin', 'uglify'] grunt.registerTask 'default', ['concat', 'jasmine', 'sass', 'cssmin', 'uglify']
...@@ -45,6 +45,10 @@ function Chart(config) { ...@@ -45,6 +45,10 @@ function Chart(config) {
function ChartInternal(api) { function ChartInternal(api) {
var $$ = this; var $$ = this;
$$.d3 = window.d3 ? window.d3 : typeof require !== 'undefined' ? require("d3") : undefined; $$.d3 = window.d3 ? window.d3 : typeof require !== 'undefined' ? require("d3") : undefined;
if(isUndefined($$.d3)){
throw new Error("d3 is not defined. Please include it");
}
$$.api = api; $$.api = api;
$$.config = $$.getDefaultConfig(); $$.config = $$.getDefaultConfig();
$$.data = {}; $$.data = {};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment