مخطط الشريط اللوغاريتمي باستخدام بروتوفيس
-
26-09-2019 - |
سؤال
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();
أنا أستخدم الرمز أعلاه لإنشاء مخطط شريط باستخدام Protovis. كيفية تغيير هذا المخطط إلى مقياس لوغاريتمي؟
المحلول
يجب عليك استخدام pv.scale.log كوظائفك:
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();
أتمنى أن يساعدك هذا
لا تنتمي إلى StackOverflow