2
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 生成条形图。如何将此图表更改为对数刻度?

4

1 回答 1

1

您应该使用 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();

希望这可以帮助

于 2010-12-16T14:24:53.927 回答