提交 27424025 编写于 作者: P pah100

data zoom add labelformatter, and tiny adjudgest.

上级 ec271391
......@@ -25,7 +25,6 @@ define(function(require) {
defaultOption: {
zlevel: 0, // 一级层叠
z: 4, // 二级层叠
show: true,
orient: null, // 布局方式,默认根据axisIndex自适应。可选值为:'horizontal' ¦ 'vertical'
xAxisIndex: null, // 默认控制所有横向类目
yAxisIndex: null, // 默认控制所有横向类目
......
......@@ -13,6 +13,7 @@ define(function(require) {
* @protected
*/
defaultOption: {
show: true,
// left: {number}, // 水平安放位置,默认为根据grid参数适配,可选为:
// {number}(x坐标,单位px)
// top: {number}, // 垂直安放位置,默认为根据grid参数适配,可选为:
......
......@@ -562,7 +562,7 @@ define(function (require) {
_formatLabel: function (value, axis) {
var dataZoomModel = this.dataZoomModel;
var labelFormatter = dataZoomModel.get('labelFormatter');
if (labelFormatter) {
if (zrUtil.isFunction(labelFormatter)) {
return labelFormatter(value);
}
......@@ -571,13 +571,19 @@ define(function (require) {
labelPrecision = axis.getPixelPrecision();
}
return (value == null && isNaN(value))
value = (value == null && isNaN(value))
? ''
// FIXME Glue code
: (axis.type === 'category' || axis.type === 'time')
? axis.scale.getLabel(Math.round(value))
// param of toFixed should less then 20.
: value.toFixed(Math.min(labelPrecision, 20));
if (zrUtil.isString(labelFormatter)) {
value = labelFormatter.replace('{value}', value);
}
return value;
},
/**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册