js定义数组,定义对象,new对象

chartObj.series = [];//定义数组

var serie = {}定义对象;

chartObj.series.push(serie);数组添加push

注:js中定义的对象可以动态的添加属性如:serie.field=”xmbh”;或serie.data =[]

JS中new对象

function GetChartObj() {
    var ChartObj = {
        chart: {
            renderTo: ''   //绘制到DIV容器中,根据ID
        },
        title: {
            text: ''
        },
        xAxis: {
            tickWidth: 0,
            //tickInterval: 1,
            gridLineWidth: 1,
            gridLineColor: '#99CC99',
            categories: []
        },
        yAxis: [ ],
        plotOptions: {
            column: { },
            series: {
                animation: true,
                cursor: "pointer",
                events: {
                    click: function (event) { chartClick(event); }
                }
            }
        },
        credits: {
            enabled: false
        },
        tooltip: {
            shared: true,
            footerFormat: '
点击图形查看项目列表
'
        },
        legend: {
          
        },
        exporting: {
            enabled: false
        },
        series: []
    }
    return ChartObj;
}

var chartObj = newGetChartObj();

你可能感兴趣的:(javascript)