From 3aa40e56f8aa229e9d566ef685c30415210018ed Mon Sep 17 00:00:00 2001 From: Yoshiya Hinosawa Date: Mon, 5 Jun 2017 09:25:45 +0900 Subject: [PATCH] Restore the timing to store the d3 reference (#2066) * fix: restore the timing to store the d3 reference, fix #2060 * chore: modify .jshintrc --- .jshintrc | 3 ++- src/core.js | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.jshintrc b/.jshintrc index 59389cc..9255727 100644 --- a/.jshintrc +++ b/.jshintrc @@ -19,6 +19,7 @@ "jasmine": true, "globals": { - "d3": false + "d3": false, + "require": false } } diff --git a/src/core.js b/src/core.js index b432961..0a7b493 100644 --- a/src/core.js +++ b/src/core.js @@ -1,4 +1,3 @@ -import * as d3 from 'd3'; import Axis from './axis'; import CLASS from './class'; import { isValue, isFunction, isString, isUndefined, isDefined, ceil10, asHalfPixel, diffDomain, isEmpty, notEmpty, getOption, hasValue, sanitise, getPathBox } from './util'; @@ -49,7 +48,7 @@ function Chart(config) { function ChartInternal(api) { var $$ = this; - $$.d3 = d3; + $$.d3 = window.d3 ? window.d3 : typeof require !== 'undefined' ? require("d3") : undefined; $$.api = api; $$.config = $$.getDefaultConfig(); $$.data = {};