AngularJS NVD3 折线图设置 Y2 轴



我使用nvd3-line-chart angularjs指令。我的数据是:

$scope.exampleData = [
  {
      "key": "Series 1",
      "values": [ [1, 2], [2, 10], [3, 6], [4, 15], [5, 8] ]
  },
  {
      "key": "Series 2",
      "values": [ [1, 5], [2, 30], [3, 8], [4, 11], [5, 4] ]
  },
  {
      "key": "Series 3",
      "values": [ [1, 2000], [2, 10000], [3, 600], [4, 1500], [5, 8000] ]
  }
]

目录:

nvd3-line-chart(
  data="exampleData"
  id="graph-Data-1"
  width="1170"
  height="494"
  showXAxis="true"
  showYAxis="true"
  tooltips="true"
  useInteractiveGuideline="true"
  showLegend="true"
  ng-if="exampleData"
)

如何将 Y2 分配给系列 3 数据?我找到了line-plus-bar-chart指令,但我如何通过nvd3-line-chart指令来实现它?

恐怕你不能使用你的数据来渲染辅助轴。它超出了数据本身的范围。

你能做的最好的事情就是自己欺骗它:http://www.d3noob.org/2013/01/using-multiple-axes-for-d3js-graph.html

最新更新