Frage

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

Ich bin oben Code mit Hilfe eines Balkendiagramms erzeugen Protovis verwenden. Wie diese Grafik logarithmisch ändern?

War es hilfreich?

Lösung

Sie sollten pv.Scale.log als Ihre Funktion:

http://vis.stanford.edu/protovis/ jsdoc / Symbole / pv.Scale.log.html

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

....

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

vis.render();

Hope, das hilft

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top