var vis = new pv.Panel().canvas('grphLangSpeakers').height(langCount*(barWidth+barGap)).width(canvasWidth)
.add(pv.Bar)
.data(popCountArray)
.bottom(0).width(function(d){ return d})
.height(barWidth)
.top(function() {return this.index * (barGap+barWidth)});
vis.render();我正在使用上面的代码通过Protovis生成一个条形图。如何将此图表更改为对数刻度?
发布于 2010-12-16 22:24:54
你应该使用pv.Scale.log作为你的函数:
http://vis.stanford.edu/protovis/jsdoc/symbols/pv.Scale.log.html
var yScale = pv.Scale.log(0,popCountArray.length).range(0,height);
....
.top(function() yScale (this.index) );
vis.render();
希望这能有所帮助
https://stackoverflow.com/questions/4012036
复制相似问题