我在 x 轴上有字符串值,在 y 轴上有整数值使用 nvd3 如何绘制图形

I am having String values in x-axis and integer values in y-axis Using nvd3 how to plot the graph

如何使用 nvd3 使用 x 轴作为字符串值绘制堆叠面积图,y 轴应为数字 例如:-

$scope.data = [
    {
        "key": "2016-2017",
        "values": [['Cse', 100], ['ECE', 200], ['IT', 85], ['EEE', 65]]
    }
]

你不会做:

$scope.x = function(d) {
  return d[0];
}

$scope.y = function(d) {
  //coerce to number
  return +d[1];
}