您的位置:首页 > Web前端 > JavaScript

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

2014-04-29 22:47 190 查看
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: '<span style="font-size:10px;color:red;"></br>点击图形查看项目列表</span>'

},

legend: {

},

exporting: {

enabled: false

},

series: []

}

return ChartObj;

}
var chartObj = newGetChartObj();
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: