Group categories for an axis in Amcharts

Is it possible to have groups in the ambraz axis?

See an example in highcharts: an example

+4
source share
1 answer

View ... this is not an official function, but you can fake it.

You may have a graph for the label, with a Field value that is always zero. You will also need to shift the category axis so that the labels do not hide each other.

Here is an example: 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 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 below the axis
  }, ... ],
"categoryAxis": {
    "labelOffset": 15
}

(not my scene, I just found it online)

+1
source

Source: https://habr.com/ru/post/1533047/


All Articles