Question

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?

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top