#6259·nicegui

highchart on_point_click event.point_index incorrect after any Series data update

Author: aFlockerCreated Aug 7, 2026Updated Aug 23, 2026
Labelsbug

First Check

  • I added a very descriptive title here.
  • This is not a security issue (those should be reported via the security advisory instead).
  • This is not a Q&A. I am sure something is wrong with NiceGUI or its documentation.
  • I used the GitHub search to find a similar issue and came up empty.

Example Code

python
@ui.page("/test/")
async def heatmap_test():
    async def handle_cell_click(e):
        pt = heatmap_cht.options["series"][e.series_index]["data"][e.point_index]
        ui.notify(f"clicked #{e.point_index}, {pt['custom_text']}?")

    async def update_data():
        heatmap_cht.options["series"][0]["data"] = DATA
        ui.notify("data 'updated'")

    DATA = [
        {"x": 0, "y": 0, "value": "a1", "custom_text": "a_one(1st)"},
        {"x": 0, "y": 1, "value": "b1", "custom_text": "b_one(2nd)"},
        {"x": 0, "y": 2, "value": "c1", "custom_text": "c_one(3rd)"},
        {"x": 1, "y": 0, "value": "a2", "custom_text": "a_two(4th)"},
        {"x": 1, "y": 1, "value": "b2", "custom_text": "b_two(5th)"},
        {"x": 1, "y": 2, "value": "c2", "custom_text": "c_two(6th)"},
        {"x": 2, "y": 0, "value": "a3", "custom_text": "a_three(7th)"},
        {"x": 2, "y": 1, "value": "b3", "custom_text": "b_three(8th)"},
        {"x": 2, "y": 2, "value": "c3", "custom_text": "c_three(9th)"},
    ]
    HEATMAP_OPTIONS = {
        "chart": {"type": "heatmap"},
        "xAxis": {"categories": [1, 2, 3], "opposite": True},
        "yAxis": {"categories": ["a", "b", "c"], "reversed": True},
        "series": [
            {
                "data": DATA,
                "dataLabels": {
                    "enabled": True,
                },
            }
        ],
        "tooltip": {
            "useHTML": True,
            "format": """
                <div>
                <b>{series.yAxis.categories.(point.y)}</b>-><b>{series.xAxis.categories.(point.x)}</b>
                <br>{point.options.custom_text}</div>
            """,
        },
    }

    heatmap_cht = ui.highchart(
        options=HEATMAP_OPTIONS,
        extras=["heatmap"],
        on_point_click=handle_cell_click,
    )
    ui.button("Update Data", on_click=update_data)

Description

I am trying to capture clicks on individual points of a Highcharts heatmap. From what I understand (i.e. AI told me) when I specify a callback on_point_click function I would receive an object with series_index and point_index properties, which I can use to look up the actual point in the chart.options data. This works perfectly every time, initially. Even if I initialize the chart options with empty data [] and populate it with real data later (the first time only). However, every subsequent time I populate the series data, whether with new data or the exact same data I initially gave it, the point_indexes are in a totally different order.

For instance, in my simple example I have a 3x3 heatmap, I give it 9 item list (indices 0-8)and the data is arranged vertically like so:

0 3 6 1 4 7 2 5 8

so if I click the top right square it correctly says point_index 6 and I index back into the actual data array and get the point for "a3".

But then if you press the Update button and it sets cht.options["series"][0]["data"] = the exact same list (or even set it equal to itself), now the data is arranged the same way on the screen, as expected but the underlying point_indexes reported by the on_point_click event are:

0 1 2 3 5 7 4 6 8

and if I click on the top right square again (which still correctly shows "a3" in the tooltip and according to axis categories) and is still the 7th point(index 6) in the data array, it will now incorrectly say that point_index 2 was clicked and notify "c1", even though c1 was not clicked.

It seems to always happen in this same random pattern, where the point_indexes are increasing horizontally for the first row only, and then they increase vertically from left to right...

NiceGUI Version

3.14.0 (nicegui-highcharts 3.4.0)

Python Version

3.14

Browser

Chrome

Operating System

Linux

Additional Context

Image