[英]How to have (cartesian) chart axis to scale using scientific notation?
我有一個numeric
軸,我希望它顯示1.6e10、7e-10、9.9e7等。它目前正以難以置信的小十進制數字進行縮放。 Ext.util.Format.numberRenderer('0.0e')
僅顯示0.0e。
axes: [{
type: 'numeric',
position: 'left',
title: {
text: 'BER Level (log\u2081\u2080)', // 1_unicode and 0_unicode
fontSize: '14px'
},
maximum: maxAxis,
minimum: minAxis,
grid: true,
//renderer: Ext.util.Format.numberRenderer('0.0E'),
label: {
fontSize: '10px'
}
}]
我想我知道了。
在renderer
:
renderer: function(label, layout, lastLabel) {
if (Math.abs(label) < 1.0) {
var fl = Ext.util.Format.number(parseFloat(label.toString().split('e-')[0]), '0.0'); // returns String
var sn = label.toString().split('e-')[1];
var newLbl = Number(fl + 'e' + sn);
if (!isNaN(newLbl)){
label = newLbl;
}
}
else {
var fl = Ext.util.Format.number(parseFloat(label.toString().split('e')[0]), '0.0');
var sn = label.toString().split('e')[1];
var newLbl = Number(fl + 'e-' + sn);
if (!isNaN(newLbl)){
label = newLbl;
}
}
return label;
},
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.