Error in JavaScript code
Question

I am trying to display the US map in my screen using the HighChart Map.

The problem is writting the following JavaScript in the Javascriptnode.

which showing the error like 'this features are available ES6 version'.

I reffered this code in this site : https://jsfiddle.net/gh/get/jquery/1.11.0/highslide-software/highcharts.com/tree/master/samples/mapdata/countries/us/us-all

the javascript code is :

(async () => {


    const topology = await fetch(

        'https://code.highcharts.com/mapdata/countries/us/us-all.topo.json'

    ).then(response => response.json());


    // Prepare demo data. The data is joined to map using value of 'hc-key'

    // property by default. See API docs for 'joinBy' for more info on linking

    // data and map.

    const data = [

        ['us-ma', 10], ['us-wa', 11], ['us-ca', 12], ['us-or', 13],

        ['us-wi', 14], ['us-me', 15], ['us-mi', 16], ['us-nv', 17],

        ['us-nm', 18], ['us-co', 19], ['us-wy', 20], ['us-ks', 21],

        ['us-ne', 22], ['us-ok', 23], ['us-mo', 24], ['us-il', 25],

        ['us-in', 26], ['us-vt', 27], ['us-ar', 28], ['us-tx', 29],

        ['us-ri', 30], ['us-al', 31], ['us-ms', 32], ['us-nc', 33],

        ['us-va', 34], ['us-ia', 35], ['us-md', 36], ['us-de', 37],

        ['us-pa', 38], ['us-nj', 39], ['us-ny', 40], ['us-id', 41],

        ['us-sd', 42], ['us-ct', 43], ['us-nh', 44], ['us-ky', 45],

        ['us-oh', 46], ['us-tn', 47], ['us-wv', 48], ['us-dc', 49],

        ['us-la', 50], ['us-fl', 51], ['us-ga', 52], ['us-sc', 53],

        ['us-mn', 54], ['us-mt', 55], ['us-nd', 56], ['us-az', 57],

        ['us-ut', 58], ['us-hi', 59], ['us-ak', 60]

    ];


    // Create the chart

    Highcharts.mapChart('container', {

        chart: {

            map: topology

        },


        title: {

            text: 'Highcharts Maps basic demo'

        },


        subtitle: {

            text: 'Source map: <a href="http://code.highcharts.com/mapdata/countries/us/us-all.topo.json">United States of America</a>'

        },


        mapNavigation: {

            enabled: true,

            buttonOptions: {

                verticalAlign: 'bottom'

            }

        },


        colorAxis: {

            min: 0

        },


        series: [{

            data: data,

            name: 'Random data',

            states: {

                hover: {

                    color: '#BADA55'

                }

            },

            dataLabels: {

                enabled: true,

                format: '{point.name}'

            }

        }]

    });


})();

Dear Vishnu,

First thing, you can try to change 'const' to 'var'. Because for me this was the issue once. 

You can try JS hint in your script: /*jshint esversion:6 */

Also check following link which is focusing on the similar point of ES6 version.
https://www.outsystems.com/forums/discussion/54321/const-is-available-in-es6/

Regards,
Palak Patel

yeah @Palak Patel same issue for me, the js hint e: version is 8 , outsystem is supporting the version or not?




Not sure about the support of v8. Better you check with OS Technical Support in this case.

Regards,


One more possible solution mentioned by Eduardo on the thread is to use this JavaScript code in Seperate JavaScript file in the module itself. (Instead of writing in the node for the screen).
Then adding dependency of JavaScript to your required script file.

Let us know if it works for you.  

Regards,

@Palak Patel  thanks for responding,that script have a async () function which is available only in the ES8 version and i am stucking in that point, service studio not supporting that function, It supports upto ES5,Is any possible way to write that code.


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.