【问题标题】:Google charts angular data not displaying with custom cols谷歌图表角度数据不显示自定义列
【发布时间】:2017-01-26 23:08:35
【问题描述】:

我在 $scope.o 中存储了以下 javascript 对象数组

[{"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"}]

然后我对谷歌图表进行了以下设置:

$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": {}
}




}]);

如您所见,我在此处对示例应用程序所做的一切:http://angular-google-chart.github.io/angular-google-chart/docs/latest/examples/multi-chart/ 是将列更改为自定义列。

这种工作方式——图例拉过电子邮件地址标签,但图表是空的,上面没有数据。

关于为什么会发生这种情况的任何建议?

【问题讨论】:

    标签: javascript angularjs charts google-visualization


    【解决方案1】:

    已修复...我需要添加: $scope.o.push({ id: "月", 标签:“月”, 类型:“字符串” }); 在 for 循环之前。菜鸟失误!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-09-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多