0

使用以下代码时;

var pvChart = new pv.Panel();
pvChart.width(200);
pvChart.height(200); 

var pvBar = pvChart.add(pv.Bar);
pvBar.data([1,2,3]);

console.log(pvBar.fillStyle());

我得到了错误;

无法调用未定义的方法“实例”

它指的是pvBar.fillStyle(). 使用它我想检索条填充样式以供以后使用。谁能告诉我这个错误的原因以及如何解决这个问题?

4

1 回答 1

0

解决了

这是因为我在绘制条形之前请求了 fillStyle..

正确的代码;

var pvChart = new pv.Panel();
pvChart.width(200);
pvChart.height(200); 

var pvBar = pvChart.add(pv.Bar);
pvBar.data([1,2,3]);

pvChart.render();
console.log(pvBar.fillStyle());
于 2011-02-22T11:40:59.383 回答