js文件中,用了两个onload,第一个id无法调用,应该咋改才能两个ID都能显示

onload = function(){

    Highcharts.chart('twitterChart1', {

    title: {
        text: 'Solar Employment Growth by Sector, 2010-2016'
    },

    subtitle: {
        text: 'Source: thesolarfoundation.com'
    },

    yAxis: {
        title: {
            text: 'Number of Employees'
        }
    },
    legend: {
        layout: 'vertical',
        align: 'right',
        verticalAlign: 'middle'
    },

    plotOptions: {
        series: {
            label: {
                connectorAllowed: false
            },
            pointStart: 2010
        }
    },

    series: [ {
        name: 'Other',
        data: [12908, 5948, 8105, 11248, 8989, 11816, 18274, 18111]
    }],

    responsive: {
        rules: [{
            condition: {
                maxWidth: 500
            },
            chartOptions: {
                legend: {
                    layout: 'horizontal',
                    align: 'center',
                    verticalAlign: 'bottom'
                }
            }
        }]
                    }


 onload = function(){
Highcharts.chart('twitterChart2', {

    title: {
        text: 'Solar Employment Growth by Sector, 2010-2016'
    },

    subtitle: {
        text: 'Source: thesolarfoundation.com'
    },

    yAxis: {
        title: {
            text: 'Number of Employees'
        }
    },
    legend: {
        layout: 'vertical',
        align: 'right',
        verticalAlign: 'middle'
    },

    plotOptions: {
        series: {
            label: {
                connectorAllowed: false
            },
            pointStart: 2010
        }
    },

    series: [ {
        name: 'Other',
        data: [12908, 5948, 8105, 11248, 8989, 11816, 18274, 18111]
    }],

    responsive: {
        rules: [{
            condition: {
                maxWidth: 500
            },
            chartOptions: {
                legend: {
                    layout: 'horizontal',
                    align: 'center',
                    verticalAlign: 'bottom'
                }
            }
        }]
    }

});};
var chart1 =document.getElementById('twitterChart1');
chart1.highcharts({
        ....
 });

var chart2 =document.getElementById('twitterChart2');
chart2.highcharts({
        ...
});
方法一:
window.onload = function(){
    Highcharts.chart('twitterChart1', {
        ...........
    });
    Highcharts.chart('twitterChart2', {
        ...........
    });
};

方法二:
function a(){
    Highcharts.chart('twitterChart1', {
        ...........
    });
};
function b(){
    Highcharts.chart('twitterChart2', {
        ...........
    });
};
window.onload = function(){
    a();
    b();
};

方法三:
window.addEventListener("load", function () {
    Highcharts.chart('twitterChart1', {
        ...........
    });
}, false);
window.addEventListener("load", function () {
    Highcharts.chart('twitterChart2', {
        ...........
    });
}, false);