Browse java script object

0

I had previously done this question, and their answers did work in the javascript console, but this is my complete example, and I am applying what they recommended, and I have not yet been able to access the numbers or the array data. What do I think?

<div id="container" style="height: 400px"></div>


<script>

var chart = Highcharts.chart('container', {

                title: {
                    text: ''
                },
                xAxis: {
                    //categories: fecha,
                    labels: {
                        rotation: -80,
                        style:
                            {
                                fontFamily: 'Sans-serif',
                                fontSize: '12px',
                            }
                    },
                },
                credits:
                {
                    enabled: false,
                },
                plotOptions: {
                    line: {
                        dataLabels: {
                            enabled: true,
                            style: {
                                fontWeight: 'normal',
                                color: '#000000',
                                fontSize: '10px',
                                fontFamily: 'Sans-serif'
                            },
                        },
                        enableMouseTracking: false
                    },
                },
series: [{
        name: 'Installation',
        data: [43934, 52503, 57177]
    }, {
        name: 'Manufacturing',
        data: [24916, 24064, 29742]
    }, {
        name: 'Sales & Distribution',
        data: [11744, 17722, 16005]
    }, {
        name: 'Project Development',
        data: [null, null, 7988]
    }, {
        name: 'Other',
        data: [12908, 5948, 8105]
    }],
            });

for(let i  = 0; i< chart.series.length; i++){

    for(let j  = 0; j< chart.series[i].data.length; j++){

        //alert(chart.series[i].data[j]);
        //console.log(series[i].data[j]);

    }  

}

</script>
    
asked by Pollo 22.08.2018 в 20:31
source

1 answer

1

It's a matter of seeing how the objects are formatted and looping.

for(var i = 0; i<a.series.length;i++){

console.log(a.series[i].name);

    for(var j = 0; j <a.series[i].data.length; j++)
    {
        console.log("\t·"+a.series[i].data[j].y+"\n");
    }

}

I leave you a jsfiddle , greetings!

    
answered by 22.08.2018 / 21:03
source