在Extjs中,如何从3D条Y轴中删除十进制值?
我正在使用类型:“bar3d”,Extjs 6.0.2。 里面的东西我已经看过了在Extjs中,如何从3D条Y轴中删除十进制值?,extjs,Extjs,我正在使用类型:“bar3d”,Extjs 6.0.2。 里面的东西我已经看过了 axes: [{ type: 'numeric3d', integerOnly: true, minimum: 0, minorTickSteps: 1, }, { type: 'category3d', grid: true,
axes: [{
type: 'numeric3d',
integerOnly: true,
minimum: 0,
minorTickSteps: 1,
},
{
type: 'category3d',
grid: true,
title: {
text: 'Queues'
}
}]
如何删除y轴上的小数?我只将整数值推送到y轴。一种方法是在轴上设置majorTickSteps,以匹配轴的最大值和最小值之间的差异。由于已将最小值设置为0,因此只需确定存储中calls字段的最大值。这将自动成为轴上的最大值,因此无需设置最大值
axes: [{
type: 'numeric3d',
minimum: 0,
majorTickSteps: store.max('calls'),
fields: ['calls']
}, {
type: 'category3d',
position: 'bottom',
title: 'Categories',
fields: ['name'],
}],
参见小提琴:
如果您有非整数值,则需要将最大值和majorTickSteps设置为大于最大值的下一个最高整数。通过在轴渲染上添加一个小检查,可以轻松删除Y轴中的小数
axes: [{
type: 'numeric3d',
position: 'left',
minimum:0,
fields: ['field1','field2'],
renderer: function (label, layout, lastLabel) {
var string = layout.toString();
var found = string.indexOf('.');
if(found == '-1') {
return layout;
} else {
return ' '
}
},
grid: {
odd: {
fillStyle: 'rgba(245, 245, 245, 2)'
},
even: {
fillStyle: 'rgba(255, 255, 255, 2)'
}
},
title: {
text: 'Title Name'
}
}]