Unable to display data label for funnel in highchart

Hi , I have data in 3 columns for a highcharts funnel. But the data label to be displayed is not in any column. It is the column name.

Here is my code:
“series”: [
{
“name”: “Students”,
“data”: [
[ “getColumn”, 1],
[ “getColumn”, 2],
[ “getColumn”, 3]
]
}
]

See attached pic where the data label is “slice” for all components of the funnel. I want it to say different words based on what column is being represented.

The solution given in Update the data label names with column names in highchart funnel - Question & Answer - Amazon QuickSight Community does not help. My metrics are in 3 different columns and the data labels are not in any column, rather is the column name.

Thanks,
Amita

1 Like

Hello Amita, hope this message finds you fine.
If I understand well, you have 3 different columns instead of 1.
so, if it’s right, my suggestion is something like:

{
    chart: {
        type: 'funnel'
    },
    title: {
        text: 'Funnel Chart'
    },
    series: [{
        name: 'Students',
        data: [
            { name: 'Column 1 Name', y: getColumn(1) },
            { name: 'Column 2 Name', y: getColumn(2) },
            { name: 'Column 3 Name', y: getColumn(3) }
        ]
    }]
}

please, tell me if it’s work

Hi @lary_andr , Thanks for your quick response.
I tried the following code as in QS everything must be enclosed in ".

“series”: [
{
“type”:“funnel”,
“name”: “Students”,
“data”: [
{“name”:“Applications”,“y”:[“getColumn”, 3]},
{ “name”:“Admits”,“y”:[“getColumn”, 4]},
{ “name”:“Accepts”,“y”:[“getColumn”, 5]}
]
}
]

The entire visual became blank.

And the following warnings are displayed.

You can use getColumnName expression to get the name of the column in a field well. However note, that the second argument of your array must be a number, not an array of numbers that ["getColumn", 1] produce. E.g.:

{
  "plotOptions": {
    "series": {
      "dataLabels": {
        "enabled": true,
        "format": "<b>{point.name}</b> ({point.y:,.0f})",
        "softConnector": true
      },
      "center": ["40%", "50%"],
      "neckWidth": "30%",
      "neckHeight": "25%",
      "width": "80%"
    }
  },
  "series": [
    {
      "type": "funnel",
      "data": [
        [["getColumnName", 1], 20],
        [["getColumnName", 2], 40]
      ]
    }
  ]
}

Thanks.
I cannot use a integer for the metric part as that value changes depending on users choices … which I control via filters.
I can input a string for the column name as that is always the same but I need to use “getColumn” for the metric as that is not known before hand.

I was able to get it work using reduce.
“series”: [
{
“name”: “Students”,
“data”: [ [[ “getColumnName”, 0], [“reduce”, [“getColumn”,0], [“+”, [“acc”], [“item”]], 0]],
[[ “getColumnName”, 1],[“reduce”, [“getColumn”,1], [“+”, [“acc”], [“item”]], 0]],
[[ “getColumnName”, 2],[“reduce”, [“getColumn”,2], [“+”, [“acc”], [“item”]], 0]]
]
}
]