Logarithmiques graphique à barres à l'aide Protovis
-
26-09-2019 - |
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();
J'utilise code ci-dessus pour générer un graphique à barres à l'aide Protovis. Comment modifier ce tableau à l'échelle logarithmiques?
La solution
Vous devez utiliser pv.Scale.log comme fonction:
http://vis.stanford.edu/protovis/ jsdoc / symboles / 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
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow