Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs 如何在角度指令内绘制nvd3折线图_Angularjs_Nvd3.js - Fatal编程技术网

Angularjs 如何在角度指令内绘制nvd3折线图

Angularjs 如何在角度指令内绘制nvd3折线图,angularjs,nvd3.js,Angularjs,Nvd3.js,如何使用nvd3角度指令绘制折线图 我注意到了这一点 对于我的数据,我无法绘制图表。我需要更改这里的代码吗 有人能帮我解决这个问题吗 Myscope: $scope.data = [{ "x": "2015-10-01", "y": "244" }, { "x": "2015-07-01", "y": "0" },

如何使用nvd3角度指令绘制折线图

我注意到了这一点

对于我的数据,我无法绘制图表。我需要更改这里的代码吗

有人能帮我解决这个问题吗

Myscope:

 $scope.data = [{
                "x": "2015-10-01",
                "y": "244"
    },
            {
                "x": "2015-07-01",
                "y": "0"
    },
            {
                "x": "2015-06-01",
                "y": "117"
    },
            {
                "x": "2015-05-01",
                "y": "5353"
    },
            {
                "x": "2015-04-01",
                "y": "11159"
    },
            {
                "x": "2015-03-01",
                "y": "7511"
    },
            {
                "x": "2015-02-01",
                "y": "6906"
    },
            {
                "x": "2015-01-01",
                "y": "10816"
    },
            {
                "x": "2014-12-01",
                "y": "3481"
    },
            {
                "x": "2014-11-01",
                "y": "1619"
    },
            {
                "x": "2014-10-01",
                "y": "4084"
    },
            {
                "x": "2014-09-01",
                "y": "1114"
    }];

$scope.options = {
        chart: {
            type: 'lineChart',
            height: 450,
            margin: {
                top: 20,
                right: 20,
                bottom: 40,
                left: 55
            },
            x: function (d) { return d.x; },
            y: function (d) { return d.y; },
            useInteractiveGuideline: true,
            xScale: d3.time.scale(),
            "xAxis": {
             "axisLabel": "Months (ms)"
             },
            "yAxis": {
                "axisLabel": "WW (v)",
                "axisLabelDistance": -10
            }
            xAxis: {
                axisLabel: 'Months',
                ticks: d3.time.months,
                tickFormat: function (d) {                    

                    return d3.time.format('%Y %b')(new Date(d));

                }
            },
            yAxis: {
                axisLabel: 'WW',
                tickFormat: function (d) {


                    if (d == null) {
                        return 0;
                    }

                    return d3.format('.02f')(d);
                },
                axisLabelDistance: 30
            }
        }
    };
我的html:

  <nvd3 options="options" data="data"></nvd3>        

这个问题不是很清楚,但我会尽力帮助你

  • 如果您想在nd3.js中使用angular,那么找到一些模块比像这样帮助您更容易
  • 如果您知道这一点,并且只想创建一个与问题中的链接类似的图表,则可以使用
    angular-nvd3
    模块(上面的是链接),该指令是

    <nvd3 options="options" data="data"></nvd3>
    
    
    
  • 你可以看到这个笨蛋 它有你想要的angular和nvd3.js图表,你只需更改选项和数据即可满足你的需要 (插入器来自模块)
    我希望这会有所帮助。

    朋友,问题在于你的数据,请查看你的链接,日期如下:“1409509800000”你必须将日期转换为该格式,请记住在$scope.data中使用{“key”:“Line1”,“color”:“#008000”,“value”:[此处将数组XY]}