echarts
Version:
A powerful charting and visualization library for browser
39 lines (31 loc) • 810 B
JavaScript
var zrUtil = require('zrender/lib/core/util');
var axisHelper = require('./axisHelper');
function getName(obj) {
if (zrUtil.isObject(obj) && obj.value != null) {
return obj.value;
}
else {
return obj;
}
}
/**
* Get categories
*/
function getCategories() {
return this.get('type') === 'category'
&& zrUtil.map(this.get('data'), getName);
}
/**
* Format labels
* @return {Array.<string>}
*/
function getFormattedLabels() {
return axisHelper.getFormattedLabels(
this.axis,
this.get('axisLabel.formatter')
);
}
module.exports = {
getFormattedLabels: getFormattedLabels,
getCategories: getCategories
};