Building a dynamic chart with Custom Highcharts

Hi everyone,

This is my first post here, so apologies for any mistakes or formatting issues!
I’m building a custom Highcharts visualization inside Amazon QuickSight and running into some challenges.

Goal: One visual that dynamically shows 1–4 axes based on selected data points in controls, including a legend. The visual should display Y-axes based on the parameters selected in controls. If multiple data points share the same unit (e.g., several temperature values in Celsius), they should appear on the same axis, but as separate lines with individual legend entries.

Setup:

  • SPICE enabled

  • Data source: Athena

  • Using custom Highcharts for rendering.

  • Columns: timestamp, description, value, unit, etc.

Column 1 Column 2 Column 3 Column 4
Methanol Consumption LITER 2025-01-01T08:07:12.000Z 50
Gas Consumption CUBICMETER 2025-01-01T08:07:12.000Z 300
Energy Consumption KWH 2025-01-01T08:07:13.000Z 2500
Methanol Consumption LITER 2025-01-01T08:07:13.000Z 51
Temperature (Furnace 1) CELSIUS 2025-01-01T08:07:12.000Z 371
Temperature (Furnace 2) CELSIUS 2025-01-01T08:07:13.000Z 801
  • Unit Control: Allows users to select one or multiple measurement units (e.g., °C, kWh, %, etc.).

  • Description Control: Lets users choose one or multiple data point descriptions (e.g., “Temperature”, “Energy Consumption”, etc.).

  • These controls are tied to QuickSight parameters, which dynamically filter the dataset.

  • A timestamp filter control.

Issues I’m facing:

  1. Automatic aggregation: QuickSight aggregates values by default, but I need to show every single record exactly as it is.

  2. Multi-value parameter logic: When the control is set to “All values,” my getParameterValue() logic breaks for multi-select parameters.

  3. Dynamic axes and titles:

    • Axes should appear or disappear depending on how many units are selected.

    • Titles should update dynamically based on selected parameters.

    • If multiple data points share the same unit, I need multiple legend entries, but I cannot useunique and map with dynamic axes.

Sorry for not providing a sample dashboard as my controls dynamically change the SQL query, and this isn’t possible in QuickSight’s Arena environment.

Here’s what I have so far:

{
  "xAxis": {
    "type": "datetime",
    "gridLineWidth": 1
  },
  "yAxis": [
    {
      "title": {
        "text": ["get", ["getParameterValue", "Unit"], 0]
      },
      "labels": {
        "enabled": ["get", ["getParameterValue", "Unit"], 0],
        "style": {
          "color": "#035970"
        }
      },
      "opposite": false
    },
    {
      "title": {
        "text": ["get", ["getParameterValue", "Unit"], 1]
      },
      "labels": {
        "enabled": ["get", ["getParameterValue", "Unit"], 1],
        "style": {
          "color": "#8D1E77"
        }
      },
      "opposite": true
    },
    {
      "title": {
        "text": ["get", ["getParameterValue", "Unit"], 2]
      },
      "labels": {
        "enabled": ["get", ["getParameterValue", "Unit"], 2],
        "style": {
          "color": "#E96D0C"
        }
      },
      "opposite": false
    },
    {
      "title": {
        "text": ["get", ["getParameterValue", "Unit"], 3]
      },
      "labels": {
        "enabled": ["get", ["getParameterValue", "Unit"], 3],
        "style": {
          "color": "#508130"
        }
      },
      "opposite": true
    }
  ],
  "tooltip": {
    "xDateFormat": "%d.%m.%Y %H:%M:%S",
    "headerFormat": "<span style=\"font-size: 13px; font-weight: bold;\">Datum: {point.key} <br/>Beschreibung: {series.name}</span><br/>",
    "pointFormat": "<b>Messwert:</b> {point.y} {point.unit}"
  },
  "series": [
    {
      "type": "scatter",
      "color": "#035970",
      "yAxis": 0,
      "data": [
        "map",
        [
          "filter",
          ["getColumn", 0, 3, 2, 1],
          [
            "==",
            ["get", ["item"], 2],
            ["get", ["getParameterValue", "Unit"], 0]
          ]
        ],
        {
          "x": ["get", ["item"], 0],
          "y": ["get", ["item"], 1],
          "unit": ["get", ["item"], 2],
          "name": ["get", ["item"], 3]
        }
      ]
    },
    {
      "type": "scatter",
      "color": "#8D1E77",
      "name": ["get", ["getParameterValue", "Unit"], 1],
      "yAxis": 1,
      "data": [
        "map",
        [
          "filter",
          ["getColumn", 0, 3, 2, 1],
          [
            "==",
            ["get", ["item"], 2],
            ["get", ["getParameterValue", "Unit"], 1]
          ]
        ],
        {
          "x": ["get", ["item"], 0],
          "y": ["get", ["item"], 1],
          "unit": ["get", ["item"], 2]
        }
      ]
    },
    {
      "type": "scatter",
      "color": "#E96D0C",
      "name": ["getParameterValue","Desc"],
      "yAxis": 2,
      "data": [
        "map",
        [
          "filter",
          ["getColumn", 0, 3, 2, 1],
          [
            "==",
            ["get", ["item"], 2],
            ["get", ["getParameterValue", "Unit"], 2]
          ]
        ],
        {
          "x": ["get", ["item"], 0],
          "y": ["get", ["item"], 1],
          "unit": ["get", ["item"], 2]
        }
      ]
    },
    {
      "type": "scatter",
      "color": "#508130",
      "name": "Neue Serie 4",
      "yAxis": 3,
      "data": [
        "map",
        [
          "filter",
          ["getColumn", 0, 3, 2, 1], // 0: timestamp, 3: value, 2: Unit, 1: Description
          [
            "==",
            ["get", ["item"], 2],
            ["get", ["getParameterValue", "Unit"], 3]
          ]
        ],
        {
          "x": ["get", ["item"], 0],
          "y": ["get", ["item"], 1],
          "unit": ["get", ["item"], 2]
        }
      ]
    }
  ]
}

Thanks so much for taking the time to read this—I’d love to hear your thoughts!

Hi @Julia1

Quick default aggregation can be bypassed by adding fields (timestamp, description, unit, value) as dimensions only, no measures or group-by, so getColumn receives raw rows from your Athena/SPICE dataset. For parameters value like Unit, filter upstream in your SQL (WHERE unit IN ${UnitParam}) to pre-limit data,

Please refer to the below documentation this might be helpful for you.

https://democentral.learnquicksight.online/#Analysis-FeatureDemo-Highcharts-Visual

1 Like

Hi, @Julia1 Did this solution work for you? I am marking this reply as, “Solution,” but let us know if this is not resolved. Thanks for posting your questions on the Quick Community Q&A Forum!

Hi @Xclipse ,

Thank you for your answer. That’s a great tip - I really appreciate you sharing it! I actually didn’t know that using only dimensions can bypass QuickSight’s default aggregation, so that’s very helpful.

However, in my case, this approach quickly runs into the data point limit, and then QuickSight silently reduces the displayed time range.

What I need instead is to fully utilize the maximum data point limit first, and only then apply aggregation or sampling if necessary—rather than shrinking the time window.

Is there any way to implement a drill-down (or something similar) in a custom Highcharts visual? Or do you have any suggestions on how I could achieve that behavior?