QuickSight HighChart Visual color customization

Hello,

I am new to HighCharts and how it works with QuickSight. I have two questions. First, I want to create a simple bar chart where a category with a specific name should be colored in a different color than the default color for all other bars.

I am using the following code to generate the chart and color the bar with the name “HD screens”

{
  "xAxis": {
    "categories": ["getColumn", 0],
    "dataPoint": { "name": "HQ Screens", "color": "Red" }
  },
  "series": [
    {
      "type": "column",
      "name": "Total Sales",
      "data": ["getColumn", 1]
    }
  ]
}

The second question is about category change. I want to color a bar based on the user’s selection through a parameter. Can this be linked to the JSON expression or not?

The first question can be answered by passing multiple columns, then using mapping, we can choose which column to apply the condition on.

For the second question, we create a calculated field that gets its value from the parameter. Then we add the calculated column to the field wells for example, the X axis to get the categories we want to filter, from the mapping we get the column index

here is the final code:

{
  "xAxis": {
    "categories": ["getColumn", 0]
  },
  "series": [
    {
      "name": "Values",
      "type": "column",
      "data": [
        "map",
        ["getColumn", 2, 0, 1],  // Assuming the values are in the second column
        {
          "y": ["get", ["item"], 0],
          "color": [
            "case",
            ["==", ["get", ["item"], 1], ["get", ["item"], 2]],
            "#FF0000",  // Red color for "Independent"
            "#0000FF"   // Default color (blue) for other values
          ]
        }
      ]
    }
  ]
}