amcharts.getMeasureNameByIndex(rawData: Object, index: Number)
Returns the name of a measure with the specified index from data for the chart. Use amcharts.getMeasureNameByIndex()
to set numeric values for the chart.
Parameter/Type | Description |
---|---|
rawData Object | The raw data that contains the measure name (check out the structure of rawData in getData()). The measures in rawData have the same order as in the slice. |
index Number | The index of the measure to get. |
Returns a string representing the name of a measure with the given index.
1) Setting the valueField
for pie series:
am5percent.PieSeries.new(root, { valueField: pivot.amcharts.getMeasureNameByIndex(rawData, 0), // ... })
See the full code on JSFiddle.
2) Setting the valueYField
for line series:
let series = chart.series.push(am5xy.LineSeries.new(root, { name: pivot.amcharts.getMeasureNameByIndex(rawData, 0), xAxis: xAxis, yAxis: yAxis, valueYField: pivot.amcharts.getMeasureNameByIndex(rawData, 0), valueXField: pivot.amcharts.getCategoryName(rawData), }));
See an example on JSFiddle.
Specifying the amCharts 4 Value axis:
let series = chart.series.push(new am4charts.ColumnSeries()); series.dataFields.valueY = pivot.amcharts.getMeasureNameByIndex(rawData, 0);
Check out an example on JSFiddle.
amcharts.getData
amcharts.getCategoryName
amcharts.getNumberOfMeasures
amcharts.getNumberFormatPattern