☝️Small business or a startup? See if you qualify for our special offer.
+
All documentation
  • API Reference for older versions
  • amcharts.getMeasureNameByIndex

    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.

    Parameters

    Parameter/TypeDescription
    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.

    Returns

    A string with the name of a measure at the specified index.

    Examples

    amCharts 5

    1) Setting the valueField for the pie series:

    am5percent.PieSeries.new(root, {
    valueField: pivot.amcharts.getMeasureNameByIndex(rawData, 0),
    // ...
    })

    Live example

    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),
    }));

    Live example

    amCharts 4

    Specifying the amCharts 4 value axis:

    let series = chart.series.push(new am4charts.ColumnSeries());
    series.dataFields.valueY = pivot.amcharts.getMeasureNameByIndex(rawData, 0);

    Live example

    See also