amcharts.getCategoryName(rawData: Object)
Returns the name of a field that represents a category in data for the chart.
Parameter/Type | Description |
---|---|
rawData Object | Raw data that contains the category (check out the structure of rawData in getData()). |
Returns a string, which is the name of a field representing a category in the chart's data.
1) Setting the categoryField
for pie series:
am5percent.PieSeries.new(root, { categoryField: pivot.amcharts.getCategoryName(rawData), // ... })
See the full code on JSFiddle.
2) Setting the categoryField
for the Category axis in a radar chart:
let xAxis = chart.xAxes.push(am5xy.CategoryAxis.new(root, { categoryField: pivot.amcharts.getCategoryName(rawData), renderer: xRenderer }));
See an example on JSFiddle.
Setting the name for the amCharts 4 Category axis:
let categoryAxis = chart.xAxes.push(new am4charts.CategoryAxis()); categoryAxis.dataFields.category = pivot.amcharts.getCategoryName(rawData);
See the full code on JSFiddle.
amcharts.getData
amcharts.getMeasureNameByIndex
amcharts.getNumberOfMeasures
amcharts.getNumberFormatPattern