amcharts.getMeasureNameByIndex(rawData: Object, index: Number): String
Returns the name of a measure by its index from the data for the chart. Use amcharts.getMeasureNameByIndex()
to set numeric values for the chart.
Parameter/Type | Description |
---|---|
rawData Object | Raw data that contains the measure name. Check out the structure of rawData. The measures in rawData have the same order as in the slice. |
index Number | The index of the necessary measure. |
A string with the name of a measure at the specified index.
1) Setting the valueField
for the pie series:
am5percent.PieSeries.new(root, {
valueField: pivot.amcharts.getMeasureNameByIndex(rawData, 0),
// ...
})
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),
}));
Specifying the amCharts 4 value axis:
let series = chart.series.push(new am4charts.ColumnSeries());
series.dataFields.valueY = pivot.amcharts.getMeasureNameByIndex(rawData, 0);