小编dib*_*a p的帖子

如何在amCharts中创建分组栏?

我正在使用amCharts在我的表单中创建图表.我想创建一个分组的条形图.

我的JSON数据是:

  [{date:'10-dec-2015',visits:4025,country:'USA'},{date:'10-dec-2015',visits:1182,country:'India'},{date:'10-dec-2015',visits:o,country:'Spain'},{date:'11-dec-2015',visits:1322,country:'USA'},{date:'11-dec-2015',visits:1122,country:'India'},{date:'11-dec-2015',visits:1114,country:'Spain'},{date:'12-dec-2015',visits:984,country:'India'},{date:'13-dec-2015',visits:711,country:'Poland'},]
Run Code Online (Sandbox Code Playgroud)

我现有的代码如下:

chartData = generateChartData();   //function call  
//creating column chart

var chart = AmCharts.makeChart("chartdiv", {
    "type": "serial",
    "theme": "light",
    "dataProvider": chartData,
    "categoryField": "date",
    "rotate": false,
    "startDuration": 1,
    "categoryAxis": {
        "labelRotation": 90,
        "gridPosition": "start",
        "position": "left",
        "autoGridCount": false,
    },
    "trendLines": [],
    "graphs": [
        {
            "balloonText": "[[country ]]:[[value]]",
            "fillAlphas": 0.8,
            "id": "AmGraph-1"+i,
            "lineAlpha": 0.2,
            "title": "title",
            "type": "column",
            "valueField": "visits",
             "color":colors[0]
        }
    ],
    "chartScrollbar": {
        "autoGridCount": false,
        "graph": "AmGraph-1"+i,
        "scrollbarHeight": 10
    },
    "legend": {
        "align": "center",
        "position": "right",
        "markerType": "square", …
Run Code Online (Sandbox Code Playgroud)

amcharts angularjs

5
推荐指数
1
解决办法
1665
查看次数

标签 统计

amcharts ×1

angularjs ×1