StockChart
当我使用配置对象初始化我的 HighCharts 时,对象中的series
参数设置为null
在初始化之后。为什么是这样?
代码
//object
var myClass = {
chartConfig: {
//some highcharts config
//some extra params
url: 'getData.php'
}
};
myClass.prototype.renderChart = function() {
console.log(this.chartConfig.series);
this.chart = new Highcharts.StockChart(this.chartConfig);
console.log("=======================");
console.log(this.chartConfig.series);
};
myClass.prototype.getSeriesData = function() {
var self = this;
$.getJSON(self.chartConfig.url, function(data) {
self.chartConfig.series = data;
});
};
var test = new myClass();
test.getSeriesData();
test.renderChart();
输出
[Object, Object, Object, animation: false]
=======================
null