Pergunta

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

Estou usando o código acima para gerar um gráfico de barras usando o Protovis. Como alterar este gráfico para escala logarítmica?

Foi útil?

Solução

Você deve usar PV.Scale.log como sua função:

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

Espero que isto ajude

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top