Amcharts中轴的组类别

时间:2014-03-23 11:18:13

标签: amcharts

可以在amcharts轴中拥有组吗?

检查highcharts中的示例:example

1 个答案:

答案 0 :(得分:1)

有点......这不是官方功能,但你可以伪造它。

您可以为标签添加图表,其valueField始终为零。 您还需要偏移类别轴,以便标签不会相互隐藏。

以下是一个示例:http://jsfiddle.net/amcharts/XY2cD/

// each data provider has a label property
dataProvider : 
  [{ ... ,
    "label": 0 
    }, ... ],
// the first graph in each 'cluster' is for the label
"graphs": [    
  {
    "type": "column",
    "fillAlphas": 0, // hide this column
    "lineAlpha": 0, // hide this column
    "title": "my sub group name",
    "valueField": "label", // this is the field that's always zero
    "showAllValueLabels": true, // even though the field is zero - the label will be shown
    "labelText": "\n[[title]]" // start this with a newline so it's below the axis
  }, ... ],
"categoryAxis": {
    "labelOffset": 15
}

(不是我的小提琴,我只是在网上找到它)