在angular2组件中生成D3图表的问题

时间:2016-06-17 19:36:38

标签: d3.js angular angular2-services

我尝试创建一个angular2服务,该服务将读取json文件并返回组件将使用的内容并使用D3绘制气泡图。 http服务正在返回json内容,但在生成D3 bubblechart时存在一些问题。我无法得到没有在plunker中生成图表的确切错误。我的plunker url

但是当我在本地主机中尝试时,Chrome浏览器会给出错误,如下所示

angular2-polyfills.js:487 Unhandled Promise rejection: EXCEPTION: Error in :0:0
ORIGINAL EXCEPTION: ReferenceError: d3 is not defined
ORIGINAL STACKTRACE:
ReferenceError: d3 is not defined
    at new BubbleChartComponent (http://localhost:55568/appScripts/BubbleChartComponent.js:18:22)
    at AppView._View_BubbleChartComponent_Host0.createInternal (BubbleChartComponent_Host.template.js:20:36)
    at AppView.create (https://code.angularjs.org/2.0.0-beta.16/angular2.dev.js:22641:23)
    at ComponentFactory.create (https://code.angularjs.org/2.0.0-beta.16/angular2.dev.js:7668:34)
    at https://code.angularjs.org/2.0.0-beta.16/angular2.dev.js:8215:40
    at https://code.angularjs.org/2.0.0-beta.16/angular2.dev.js:8192:20
    at ZoneDelegate.invoke (https://code.angularjs.org/2.0.0-beta.16/angular2-polyfills.js:349:29)
    at Object.onInvoke (https://code.angularjs.org/2.0.0-beta.16/angular2.dev.js:2185:31)
    at ZoneDelegate.invoke (https://code.angularjs.org/2.0.0-beta.16/angular2-polyfills.js:348:35)
    at Zone.run (https://code.angularjs.org/2.0.0-beta.16/angular2-polyfills.js:242:44)

任何想法我错过了什么?

0 个答案:

没有答案