简体   繁体   English

Google图表不以自定义列显示角度数据

[英]Google charts angular data not displaying with custom cols

I have the following array of javascript objects which I store in $scope.o 我有以下javascript对象数组,存储在$ scope.o中

[{"id":"jimmy.cibby@redsss.com","label":"marc.cibby@redsss.com","type":"number","p":{}},{"id":"matthew.cibby@redsss.com","label":"matthew.cibby@redsss.com","type":"number","p":{}},{"id":"ari.grads@redsssdsss.com","label":"ari.grads@redsssdsss.com","type":"number","p":{}},{"id":"yup@redsssdsss.com","label":"yup@redsssdsss.com","type":"number","p":{}},{"id":"service@redsssdsss.com","label":"service@redsss.com","type":"number"}]

I then have the following setup for google charts: 然后,我对Google图表进行了以下设置:

$scope.data= {
  "type": "LineChart",
  "displayed": true,
  "data": {
    "cols":$scope.o,
    "rows": [
      {
        "c": [
          {
            "v": "January"
          },
          {
            "v": 19,
            "f": "42 items"
          },
          {
            "v": 12,
            "f": "Ony 12 items"
          },
          {
            "v": 7,
            "f": "7 servers"
          },
          {
            "v": 4
          },
          {"v": 5}
        ]
      },
      {
        "c": [
          {
            "v": "February"
          },
          {
            "v": 13
          },
          {
            "v": 1,
            "f": "1 unit (Out of stock this month)"
          },
          {
            "v": 12
          },
          {
            "v": 2
          },
          {
            "v": 2
          }
        ]
      },
      {
        "c": [
          {
            "v": "March"
          },
          {
            "v": 24
          },
          {
            "v": 5
          },
          {
            "v": 11
          },
          {
            "v": 6
          },
          {
            "v":12
          }
        ]
      }
    ]
  },
  "options": {
    "title": "some data",
    "tooltip": {trigger: "selection"},
    "isStacked": "true",
    "fill": 20,
    "displayExactValues": true,
    "chartArea": {width: "70%", height: "70%"},
    "vAxis": {
      "title": "data",
      "gridlines": {
        "count": 10
      }
    },
    "hAxis": {
      "title": "month"
    }
  },
  "formatters": {}
}




}]);

as you can see, all I have done to the sample app here: http://angular-google-chart.github.io/angular-google-chart/docs/latest/examples/multi-chart/ is change the columns to custom ones. 如您所见,我在此处对示例应用程序所做的全部操作: http : //angular-google-chart.github.io/angular-google-chart/docs/latest/examples/multi-chart/将列更改为自定义的。

This kind of works- the legend pulls through the email address labels but the graph is empty with no data on it. 这种工作方式-图例显示了电子邮件地址标签,但图表为空,上面没有数据。

Any suggestions as to why this would happen? 关于为什么会发生任何建议?

Fixed it... I needed to add: $scope.o.push({ id: "month", label: "Month", type: "string" }); 修复它...我需要添加:$ scope.o.push({id:“ month”,标签:“ Month”,类型:“ string”}); before the for loop. 在for循环之前。 Rookie mistake! 菜鸟错误!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM