amchart生成柱状图(三项),需要按月分组

amchart generating a column chart(with three items), need to be grouped by month

我正在使用 Amcharts,每个月生成 3 列,我尝试了很多次,但都没有成功。 有 3 列,所有列都应按月生成。例如,对于 7 月,所有这些都应该绘制出来,同样对于 8 月和 9 月等等。

这是我的fiddle . Not sure what I am missing here. I am trying something like : this jsfiddle

  var chart = AmCharts.makeChart("chartdiv", {
  "type": "serial",
  "startDuration": 2,
  "dataProvider": [{
    "country": "China",
    "visits": 2,
    "color": "#FF6600"
  }, {
    "country": "Germany",
    "visits": 5,
    "color": "#FCD202"
  },{
    "country": "Spain",
    "visits": 9,
    "color": "#0D8ECF"
  }],
  "valueAxes": [{
    "position": "left",
    "title": "Visitors"
  }],
  "graphs": [{
    "balloonText": "[[category]]: <b>[[value]]</b>",
    "colorField": "color",
    "fillAlphas": 1,
    "lineAlpha": 0.1,
    "type": "column",
    "valueField": "visits"
  }],
  "depth3D": 20,
  "angle": 30,
  "chartCursor": {
    "categoryBalloonEnabled": false,
    "cursorAlpha": 0,
    "zoomable": false
  },
  "categoryField": "country",
  "categoryAxis": {
    "gridPosition": "start",
    "labelRotation": 90
  },
  "listeners": [{
    "event": "clickGraphItem",
    "method": function(event) {
      alert(event.item.category);
    }
  }]
});

如有任何建议,我们将不胜感激!

您没有指定需要绘制条形图的数据。您需要在数据

graphs 字段中包含要绘制的列

例如:

"graphs": [{
    "balloonText": "[[category]]: <b>[[value]]</b>",
    "colorField": "color",
    "fillAlphas": 1,
    "lineAlpha": 0.1,
    "type": "column",
    "valueField": "europe"
}]