0
時,我不斷收到此錯誤:錯誤渲染nvd3條形圖
Uncaught TypeError: Cannot call method 'map' of undefined
運行此代碼:
var testdata = [
{
label: "One",
x: 5,
y: 10
},
{
label: "2",
x: 6,
y: 15
},
{
label: "3",
x: 5,
y: 25
},
{
label: "4",
x: 10,
y: 0
}
];
nv.addGraph(function() {
var width = nv.utils.windowSize().width - 40,
height = nv.utils.windowSize().height/2 - 40;
var chart = nv.models.multiBar()
.stacked(true)
.width(width)
.height(height);
d3.select("#lschart svg")
.datum(testdata)
.transition().duration(1200)
.attr('width', width)
.attr('height', height)
.call(chart);
return chart;
});