Pregunta

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

Estoy usando por encima de código para generar un gráfico de barras usando Protovis. ¿Cómo cambiar esta tabla para la escala logarítmica?

¿Fue útil?

Solución

Se debe utilizar pv.Scale.log como su función:

http://vis.stanford.edu/protovis/ jsdoc / símbolos / pv.Scale.log.html

var yScale = pv.Scale.log(0,popCountArray.length).range(0,height);

....

.top(function() yScale (this.index) );

vis.render();

Espero que esto ayude

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top