nvd3 TypeError:无法读取null

时间:2017-01-18 13:30:33

标签: javascript angularjs d3.js nvd3.js

我遇到了nvd3折线图的问题。有时图表显示没有标签和线条。它只显示点数。但有时使用标签和线条生成相同的数据。当我不断刷新或更改数据时会发生这种情况。问题形象, enter image description here

控制台显示以下问题,

enter image description here

更新:

nvd3图表生成器代码

var option = {
                chart: {
                    lines: {
                        dispatch: {
                            elementClick: function (e, scope) {
                                console.log(e.data);     
                            } 
                        },
                    },
                    "type": "lineChart",
                    "height": 400, 
                    "tooltip": {
                        contentGenerator: function (key, x, y, e, graph) {
                            return  'test' 
                            }  
                     },
                    "showLegend": false,
                    "margin": {
                        top: 50,
                        right: 50,
                        bottom: 60,
                        left: 100
                    }, 
                    "dispatch": {},
                    xAxis: {
                        "tickSize": 1,
                        "axisLabelDistance": 1,
                        "showMaxMin": false,
                    },
                    yAxis: {
                        axisLabelDistance: -5,
                        tickPadding: 10,  
                    },
                    reduceXTicks: false,
                    useInteractiveGuideline: false
                }  
            };

有人帮助解决此问题, 提前谢谢。

0 个答案:

没有答案