【发布时间】:2016-07-22 23:10:01
【问题描述】:
我正在尝试一个非常基本的angular-nvd3 概念证明,以尝试根据angular-nvd3 文档获取演示图表来呈现。
在Plunker查看示例代码
我使用的是直线图示例,但在浏览器控制台中出现此错误:
angular.js:12477 TypeError: Cannot read property 'category20' of undefined
at Object.nv.utils.defaultColor (nv.d3.js:987)
at Object.nv.models.scatter (nv.d3.js:11844)
at Object.nv.models.line (nv.d3.js:6467)
at Object.nv.models.lineChart (nv.d3.js:6696)
at Object.scope.api.updateWithOptions (angular-nvd3.js:95)
at Object.scope.api.refresh (angular-nvd3.js:45)
at Object.<anonymous> (angular-nvd3.js:437)
at Object.fn (angular-nvd3.js:505)
at n.$digest (angular.js:15826)
at n.$apply (angular.js:16097)
我尝试了各种图表选项,试图找到任何可以呈现图表的东西,但所有变化似乎都表明d3.scale 是Object.nv 内部的undefined 某处。然而,我只是使用来自angular-nvd3 示例的确切图表选项和数据。
谁能看到我做错了什么以及如何在使用angular-nvd3 时克服这个d3.scale 未定义?
【问题讨论】:
标签: javascript angularjs d3.js nvd3.js angular-nvd3