For our project we use the Highchart plug-in. I,ve made an function to create different charts. The settings of the different charts are almost the same. There are some little differences in the settings:
function createBarDiagram(div,title,xtitle,ytitle,first,second,type){
    // Internationalization
    Highcharts.setOptions({lang: {drillUpText: '◁ Terug naar {series.name}'}});
    if(type == 'pie'){
        var options1 = {                        
            tooltip: {pointFormat: 'Percentage: <b>{point.percentage:.1f}%</b><br>'},       
            xAxis: {categories: true}
        };
    }
    if(type == 'column'){
        var options1 = {
            xAxis: {
                categories: true,
                labels : { rotation: -90}
            }
        };  
    }
    // algemene instellingen
    var options = {
        yAxis: {title: {text: 'Aantal'}},
        chart: {height: 300},
        title: {text: ''},
        drilldown: {series: second},
        legend: {enabled: false},
        credits: {enabled: false},
        plotOptions: {
            series: {
                dataLabels: {enabled: true},
                shadow: false,
                cursor: 'pointer',
                point: {
                    events: {
                        click: function() {getDetailData(this);}
                    }
                }               
            },
            pie: {size: '100%'}
        },
        series: [{
            name: 'overzicht',
            colorByPoint: true,
            data: first
        }]  
    };  
    // Column charts
    options.chart.renderTo = div;
    options.chart.type = type;
    var chart = new Highcharts.Chart(options);
    return chart;
}
As you can see the chart is loaded based on the options var. But i like to add the options1 var also to the chart for the little differences per chart. So i need:
var options = options + options1;
Is there a way to merge these two? Thanks!
 
     
     
    