Angularjs 如何在角度指令内绘制nvd3折线图
如何使用nvd3角度指令绘制折线图 我注意到了这一点 对于我的数据,我无法绘制图表。我需要更改这里的代码吗 有人能帮我解决这个问题吗 Myscope:Angularjs 如何在角度指令内绘制nvd3折线图,angularjs,nvd3.js,Angularjs,Nvd3.js,如何使用nvd3角度指令绘制折线图 我注意到了这一点 对于我的数据,我无法绘制图表。我需要更改这里的代码吗 有人能帮我解决这个问题吗 Myscope: $scope.data = [{ "x": "2015-10-01", "y": "244" }, { "x": "2015-07-01", "y": "0" },
$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>
这个问题不是很清楚,但我会尽力帮助你
angular-nvd3
模块(上面的是链接),该指令是
<nvd3 options="options" data="data"></nvd3>
我希望这会有所帮助。朋友,问题在于你的数据,请查看你的链接,日期如下:“1409509800000”你必须将日期转换为该格式,请记住在$scope.data中使用{“key”:“Line1”,“color”:“#008000”,“value”:[此处将数组XY]}