sjmcarter
Posts: 12
Joined: Wed Jul 31, 2019 6:08 pm

accessibility.src.js:3225 Uncaught TypeError: a.id.indexOf is not a function

I have a scatter chart and am getting the following error when accessibility is enabled for the series:

Code: Select all

accessibility.src.js:3225 Uncaught TypeError: a.id.indexOf is not a function
    at d (accessibility.src.js:3225:89)
    at G (accessibility.src.js:3298:109)
    at E (accessibility.src.js:3313:72)
    at accessibility.src.js:3334:21
    at Array.forEach (<anonymous>)
    at x (accessibility.src.js:3347:17)
    at describeSeries (accessibility.src.js:3429:17)
    at accessibility.src.js:4032:25
    at Array.forEach (<anonymous>)
    at b.onChartRender (accessibility.src.js:4027:17)
Disabling accessibility for the series works fine. Here is a console log of all the data contained within a point:

Code: Select all

category: 2017.81
clientX: 417.53285714285
cohort: "2015"
color: "#a00808"
colorIndex: undefined
credits_yr0: "0.000000"
credits_yr1: "47.000000"
credits_yr2: "77.000000"
credits_yr3: "101.000000"
credits_yr4: null
credits_yr5: null
credits_yr6: null
formatPrefix: "point"
graphic: f {element: text.highcharts-point, height: undefined, opacity: 1, renderer: d, SVG_NS: 'http://www.w3.org/2000/svg', …}
hasImage: false
icon-series: 1
id: 413125
index: 3
isInside: true
isNull: false
/*keys: (2) ['y', 'id']   */  //I added this to the point definition to see if it would fix the issue, but it doesn't
name: undefined
negative: false
obs: "413125"
options: {obs: '413125', …}
percentage: undefined
plotX: 417.53285714285
plotY: 209.196
proceed: null
selected: false
series: k {_i: 0, chart: f, data: Array(19), eventOptions: {…}, eventsToUnbind: Array(1), …}
state: ""
status_year: "3"
student_status: "Dropped Out"
student_type: "Freshmen"
title: "Dropped Out"
total: undefined
total_credits: "101.000000"
touched: false
visible: true
x: 2017.81
y: 101
yBottom: null
zone: 0
Any insight on this?
hubert.k
Posts: 1164
Joined: Mon Apr 11, 2022 11:48 am

Re: accessibility.src.js:3225 Uncaught TypeError: a.id.indexOf is not a function

Hello sjmcarter!
Sadly, I cannot tell you what is not working and what could be done without taking look at your code. Could you reproduce the issue in an online editor that I could work on? You can start e.g. here: https://jsfiddle.net/BlackLabel/0pbeym97/

I am looking for your response.
Kind regards!
Hubert Kozik
Highcharts Developer
sjmcarter
Posts: 12
Joined: Wed Jul 31, 2019 6:08 pm

Re: accessibility.src.js:3225 Uncaught TypeError: a.id.indexOf is not a function

I think I've figured out the issue, and it was on my end. Thank you.
hubert.k
Posts: 1164
Joined: Mon Apr 11, 2022 11:48 am

Re: accessibility.src.js:3225 Uncaught TypeError: a.id.indexOf is not a function

That's great to hear! In case of any further questions, feel free to contact us again.
Hubert Kozik
Highcharts Developer
sjmcarter
Posts: 12
Joined: Wed Jul 31, 2019 6:08 pm

Re: accessibility.src.js:3225 Uncaught TypeError: a.id.indexOf is not a function

Actually, I though I had resolved the error, but in actuality had disabled accessibility for the chart. When I enabled it again, the error is back.

One thing of note is that this code itself is running fine in an old project (Laravel 5.2, Highcharts 8.2.2). I basically copied and pasted this whole module into a Laravel 9 project, but am using Highcharts 9.0.1 now. In the old project, no errors at all and the accessibility works as intended.

Error:
Uncaught TypeError: a.id.indexOf is not a function
at d (accessibility.js:79:21)
at G (accessibility.js:80:235)
at E (accessibility.js:80:388)
at accessibility.js:83:211
at Array.forEach (<anonymous>)
at x (accessibility.js:81:300)
at describeSeries (accessibility.js:85:125)
at accessibility.js:102:45
at Array.forEach (<anonymous>)
at b.onChartRender (accessibility.js:101:473)

Here is the relevant points of failure in https://code.highcharts.com/9.0.1/modul ... ibility.js:

Code: Select all

        /**
         * @private
         * @param {Highcharts.Point} point
         * @return {string}
         */
        function getPointXDescription(point) {
            var timeDesc = getPointA11yTimeDescription(point), xAxis = point.series.xAxis || {}, pointCategory = xAxis.categories && defined(point.category) &&
                    ('' + point.category).replace('<br/>', ' '), canUseId = point.id && [b]point.id.indexO[/b]f('highcharts-') < 0, fallback = 'x, ' + point.x;
            return point.name || timeDesc || pointCategory ||
                (canUseId ? point.id : fallback);
        }


Here is an example of where the error is occurring:

Code: Select all

       
       //When I comment out the setData block, there is no error
       swarmChart.series[0].setData(data[3], true, {
            easing: 'easeTo',
            duration: 1000
        }, true);

I did a console log of what the actual value of data[3] was, and it is this:

Code: Select all

[
    {
        "obs": "416106",
        "campus": "Bakersfield",
        "campus_code": "35",
        "college": "School of Arts & Humanities",
        "major": "Art",
        "cohort": "2015",
        "student_type": "Freshmen",
        "credits_yr0": "0.000000",
        "credits_yr1": "42.000000",
        "credits_yr2": null,
        "credits_yr3": null,
        "credits_yr4": null,
        "credits_yr5": null,
        "credits_yr6": null,
        "total_credits": "42.000000",
        "max_year": 1,
        "student_status": "Dropped Out",
        "status_year": "1",
        "major_switch": "0",
        "major_switch_year": "0",
        "grad_campus": null,
        "id": 416106,
        "y": 0,
        "x": 2014.5,
        "color": "black",
        "title": "Enrolled",
        "icon-series": 0,
        "visible": true
    },
    {
        "obs": "417227",
        "campus": "Bakersfield",
        "campus_code": "35",
        "college": "School of Arts & Humanities",
        "major": "Art",
        "cohort": "2015",
        "student_type": "Freshmen",
        "credits_yr0": "0.000000",
        "credits_yr1": "50.000000",
        "credits_yr2": "77.000000",
        "credits_yr3": null,
        "credits_yr4": null,
        "credits_yr5": null,
        "credits_yr6": null,
        "total_credits": "77.000000",
        "max_year": 2,
        "student_status": "Dropped Out",
        "status_year": "2",
        "major_switch": "1",
        "major_switch_year": "1",
        "grad_campus": null,
        "id": 417227,
        "y": 0,
        "x": 2014.5263157894738,
        "color": "black",
        "title": "Enrolled",
        "icon-series": 0,
        "visible": true
    },
    {
        "obs": "408211",
        "campus": "Bakersfield",
        "campus_code": "35",
        "college": "School of Arts & Humanities",
        "major": "Art",
        "cohort": "2015",
        "student_type": "Freshmen",
        "credits_yr0": "0.000000",
        "credits_yr1": "39.000000",
        "credits_yr2": "70.000000",
        "credits_yr3": null,
        "credits_yr4": null,
        "credits_yr5": null,
        "credits_yr6": null,
        "total_credits": "70.000000",
        "max_year": 2,
        "student_status": "Dropped Out",
        "status_year": "2",
        "major_switch": "0",
        "major_switch_year": "0",
        "grad_campus": null,
        "id": 408211,
        "y": 0,
        "x": 2014.5526315789473,
        "color": "black",
        "title": "Enrolled",
        "icon-series": 0,
        "visible": true
    },
    {
        "obs": "413125",
        "campus": "Bakersfield",
        "campus_code": "35",
        "college": "School of Arts & Humanities",
        "major": "Art",
        "cohort": "2015",
        "student_type": "Freshmen",
        "credits_yr0": "0.000000",
        "credits_yr1": "47.000000",
        "credits_yr2": "77.000000",
        "credits_yr3": "101.000000",
        "credits_yr4": null,
        "credits_yr5": null,
        "credits_yr6": null,
        "total_credits": "101.000000",
        "max_year": 3,
        "student_status": "Dropped Out",
        "status_year": "3",
        "major_switch": "0",
        "major_switch_year": "0",
        "grad_campus": null,
        "id": 413125,
        "y": 0,
        "x": 2014.578947368421,
        "color": "black",
        "title": "Enrolled",
        "icon-series": 0,
        "visible": true
    },
    {
        "obs": "428550",
        "campus": "Bakersfield",
        "campus_code": "35",
        "college": "School of Arts & Humanities",
        "major": "Art",
        "cohort": "2015",
        "student_type": "Freshmen",
        "credits_yr0": "0.000000",
        "credits_yr1": "42.000000",
        "credits_yr2": "72.000000",
        "credits_yr3": "99.000000",
        "credits_yr4": "127.000000",
        "credits_yr5": null,
        "credits_yr6": null,
        "total_credits": "127.000000",
        "max_year": 4,
        "student_status": "Dropped Out",
        "status_year": "4",
        "major_switch": "0",
        "major_switch_year": "0",
        "grad_campus": null,
        "id": 428550,
        "y": 0,
        "x": 2014.6052631578948,
        "color": "black",
        "title": "Enrolled",
        "icon-series": 0,
        "visible": true
    },
    {
        "obs": "424329",
        "campus": "Bakersfield",
        "campus_code": "35",
        "college": "School of Arts & Humanities",
        "major": "Art",
        "cohort": "2015",
        "student_type": "Freshmen",
        "credits_yr0": "0.000000",
        "credits_yr1": "44.000000",
        "credits_yr2": "74.000000",
        "credits_yr3": "104.000000",
        "credits_yr4": "110.000000",
        "credits_yr5": null,
        "credits_yr6": null,
        "total_credits": "110.000000",
        "max_year": 4,
        "student_status": "Dropped Out",
        "status_year": "4",
        "major_switch": "1",
        "major_switch_year": "1",
        "grad_campus": null,
        "id": 424329,
        "y": 0,
        "x": 2014.6315789473683,
        "color": "black",
        "title": "Enrolled",
        "icon-series": 0,
        "visible": true
    },
    {
        "obs": "412108",
        "campus": "Bakersfield",
        "campus_code": "35",
        "college": "School of Arts & Humanities",
        "major": "Art",
        "cohort": "2015",
        "student_type": "Freshmen",
        "credits_yr0": "0.000000",
        "credits_yr1": "50.000000",
        "credits_yr2": "77.000000",
        "credits_yr3": "109.000000",
        "credits_yr4": "124.000000",
        "credits_yr5": null,
        "credits_yr6": null,
        "total_credits": "124.000000",
        "max_year": 4,
        "student_status": "Dropped Out",
        "status_year": "4",
        "major_switch": "1",
        "major_switch_year": "2",
        "grad_campus": null,
        "id": 412108,
        "y": 0,
        "x": 2014.657894736842,
        "color": "black",
        "title": "Enrolled",
        "icon-series": 0,
        "visible": true
    },
    {
        "obs": "420539",
        "campus": "Bakersfield",
        "campus_code": "35",
        "college": "School of Arts & Humanities",
        "major": "Art",
        "cohort": "2015",
        "student_type": "Freshmen",
        "credits_yr0": "0.000000",
        "credits_yr1": "39.000000",
        "credits_yr2": "66.000000",
        "credits_yr3": "90.000000",
        "credits_yr4": "111.000000",
        "credits_yr5": "129.000000",
        "credits_yr6": "150.000000",
        "total_credits": "150.000000",
        "max_year": 6,
        "student_status": "Enrolled",
        "status_year": "6",
        "major_switch": "0",
        "major_switch_year": "0",
        "grad_campus": null,
        "id": 420539,
        "y": 0,
        "x": 2014.7105263157894,
        "color": "black",
        "title": "Enrolled",
        "icon-series": 0,
        "visible": true
    },
    {
        "obs": "415340",
        "campus": "Bakersfield",
        "campus_code": "35",
        "college": "School of Arts & Humanities",
        "major": "Art",
        "cohort": "2015",
        "student_type": "Freshmen",
        "credits_yr0": "0.000000",
        "credits_yr1": "47.000000",
        "credits_yr2": "75.000000",
        "credits_yr3": "105.000000",
        "credits_yr4": "120.000000",
        "credits_yr5": null,
        "credits_yr6": null,
        "total_credits": "120.000000",
        "max_year": 4,
        "student_status": "Graduated",
        "status_year": "4",
        "major_switch": "0",
        "major_switch_year": "0",
        "grad_campus": null,
        "id": 415340,
        "y": 0,
        "x": 2014.7368421052631,
        "color": "black",
        "title": "Enrolled",
        "icon-series": 0,
        "visible": true
    },
    {
        "obs": "417371",
        "campus": "Bakersfield",
        "campus_code": "35",
        "college": "School of Arts & Humanities",
        "major": "Art",
        "cohort": "2015",
        "student_type": "Freshmen",
        "credits_yr0": "0.000000",
        "credits_yr1": "49.000000",
        "credits_yr2": "77.000000",
        "credits_yr3": "110.000000",
        "credits_yr4": "143.000000",
        "credits_yr5": null,
        "credits_yr6": null,
        "total_credits": "143.000000",
        "max_year": 4,
        "student_status": "Graduated",
        "status_year": "4",
        "major_switch": "1",
        "major_switch_year": "4",
        "grad_campus": null,
        "id": 417371,
        "y": 0,
        "x": 2014.7631578947369,
        "color": "black",
        "title": "Enrolled",
        "icon-series": 0,
        "visible": true
    },
    {
        "obs": "411262",
        "campus": "Bakersfield",
        "campus_code": "35",
        "college": "School of Arts & Humanities",
        "major": "Art",
        "cohort": "2015",
        "student_type": "Freshmen",
        "credits_yr0": "0.000000",
        "credits_yr1": "50.000000",
        "credits_yr2": "85.000000",
        "credits_yr3": "117.000000",
        "credits_yr4": "144.000000",
        "credits_yr5": null,
        "credits_yr6": null,
        "total_credits": "144.000000",
        "max_year": 4,
        "student_status": "Graduated",
        "status_year": "4",
        "major_switch": "1",
        "major_switch_year": "3",
        "grad_campus": null,
        "id": 411262,
        "y": 0,
        "x": 2014.7894736842106,
        "color": "black",
        "title": "Enrolled",
        "icon-series": 0,
        "visible": true
    },
    {
        "obs": "430673",
        "campus": "Bakersfield",
        "campus_code": "35",
        "college": "School of Arts & Humanities",
        "major": "Art",
        "cohort": "2015",
        "student_type": "Freshmen",
        "credits_yr0": "0.000000",
        "credits_yr1": "43.000000",
        "credits_yr2": "70.000000",
        "credits_yr3": "102.000000",
        "credits_yr4": "135.000000",
        "credits_yr5": "147.000000",
        "credits_yr6": null,
        "total_credits": "147.000000",
        "max_year": 5,
        "student_status": "Graduated",
        "status_year": "5",
        "major_switch": "0",
        "major_switch_year": "0",
        "grad_campus": null,
        "id": 430673,
        "y": 0,
        "x": 2014.8157894736842,
        "color": "black",
        "title": "Enrolled",
        "icon-series": 0,
        "visible": true
    },
]
hubert.k
Posts: 1164
Joined: Mon Apr 11, 2022 11:48 am

Re: accessibility.src.js:3225 Uncaught TypeError: a.id.indexOf is not a function

sjmcarter,
I suggest you upgrade Highcharts to the latest version, which is Highcharts v10.2.0. We are providing support only for the latest version, so if you will have any problems with the older version, where it works differently in the new version, we will not help you. Version 9.0.1 was released in 2021, it is one year of our work and a lot of features have been improved/added/fixed. If the problem will still exist on the latest release please let me know.

Feel free to ask any further questions.
Best regards!
Hubert Kozik
Highcharts Developer

Return to “Highcharts Usage”