Angularjs nvD3,折线图,D3,角度

Angularjs nvD3,折线图,D3,角度,angularjs,d3.js,linechart,nvd3.js,Angularjs,D3.js,Linechart,Nvd3.js,有人能解释为什么我的折线图绘制不正确吗?我已将我的代码和数据放在: 有人能帮助正确地绘制它吗?图形中的线条混乱,工具提示也没有出现 function addLineChart(){ var chart; nv.addGraph(function() { chart = nv.models.lineChart() .options({ margin: {left: 100, bottom: 100

有人能解释为什么我的折线图绘制不正确吗?我已将我的代码和数据放在: 有人能帮助正确地绘制它吗?图形中的线条混乱,工具提示也没有出现

   function addLineChart(){
        var chart;
        nv.addGraph(function() {
          chart = nv.models.lineChart()
          .options({
            margin: {left: 100, bottom: 100},
          //  x: function(d,i) { return i},
            x : (function(d,i) { 
              return new Date(d.x);
            }),
            showXAxis: true,
            showYAxis: true,
            transitionDuration: 250
          })
          ;

          // chart sub-models (ie. xAxis, yAxis, etc) when accessed directly, return themselves, not the parent chart, so need to chain separately
          chart.xAxis
            .axisLabel("Time (s)")
          //  .tickFormat(d3.format(',.1f'));
          .tickFormat(function(d) {
              return d3.time.format('%m/%d/%y')(new Date(d))
            });

          chart.yAxis
            .axisLabel('Voltage (v)')
            .tickFormat(d3.format(',.2f'))
          //  .tickFormat(d3.format(',g'));
            ;


          d3.select('#chart1 svg')
            .datum(cumulativeMSIData())
            .call(chart);

          //TODO: Figure out a good way to do this automatically
          nv.utils.windowResize(chart.update);
          //nv.utils.windowResize(function() { d3.select('#chart1 svg').call(chart) });

          chart.dispatch.on('stateChange', function(e) { nv.log('New State:', JSON.stringify(e)); });

          return chart;
        });


    }

您的示例不起作用。我对使用JSFIDLE比较陌生,并且发现很难让它在JSFIDLE上工作,对此我感到抱歉。该图形与该数据和功能一起显示在我的本地浏览器中,但图形线混乱,yaxis缩放和刻度不正确。我在JSFIDLE中也包含了相关的js文件,但仍然没有显示图形,我不知道如何使它在JSFIDLE上工作。我输入的代码与我用自己的数据替换那里的数据的代码相同。你能帮我解决这个问题吗?我回答了你的问题。