开发者

Logarithmic bar chart using Protovis

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();

I'm using above code to generate a Bar Chart using Protovis. How to change this chart to Logarithmic Scale?


You should use pv.Scale.log as your function :

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();

Hope this helps

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜