grafico a barre logaritmica utilizzando Protovis
-
26-09-2019 - |
Domanda
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();
sto usando sopra il codice per generare un grafico a barre utilizzando Protovis. Come cambiare questa tabella per logaritmica Scala?
Soluzione
Si dovrebbe usare pv.Scale.log come la funzione:
http://vis.stanford.edu/protovis/ jsdoc / simboli / pv.Scale.log.html
var yScale = pv.Scale.log(0,popCountArray.length).range(0,height);
....
.top(function() yScale (this.index) );
vis.render();
Spero che questo aiuti
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow