提交 b2bd9b24 编写于 作者: L lang

Bar label

上级 00a6a0bc
......@@ -70,6 +70,7 @@ define(function (require) {
})
.remove(function (idx) {
var el = oldData.getItemGraphicEl(idx);
el.style.text = '';
el.animateTo({
shape: {
width: 0
......@@ -83,12 +84,25 @@ define(function (require) {
data.eachItemGraphicEl(function (rect, idx) {
var itemModel = data.getItemModel(idx);
var labelModel = itemModel.getModel('itemStyle.normal.label');
var color = data.getItemVisual(idx, 'color');
rect.setStyle(zrUtil.defaults(
{
fill: data.getItemVisual(idx, 'color')
fill: color
},
itemModel.getModel('itemStyle.normal').getBarItemStyle()
));
if (labelModel.get('show')) {
var labelPosition = labelModel.get('position') || 'inside';
// FIXME
var labelColor = labelPosition === 'inside' ? 'white' : color;
rect.setStyle({
text: data.getRawValue(idx),
textFont: labelModel.getModel('textStyle').getFont(),
textPosition: labelModel.get('position') === 'outside' ? 'top' : 'inside',
textFill: labelColor
});
}
graphic.setHoverStyle(
rect, itemModel.getModel('itemStyle.emphasis').getBarItemStyle()
);
......@@ -101,6 +115,8 @@ define(function (require) {
if (this._data) {
var group = this.group;
this._data.eachItemGraphicEl(function (el) {
// Not show text when animating
el.style.text = '';
el.animateTo({
shape: {
width: 0
......
......@@ -31,8 +31,8 @@ define(function (require) {
var h = 1;
// FIXME
if (symbolType.match(/(pin|Pin)$/)) {
y = -0.8;
h = 1.6;
y = -0.9;
h = 1.8;
}
var symbolEl = symbolCreators.createSymbol(
symbolType, x, y, w, h, color
......
......@@ -52,7 +52,7 @@ define(function (require) {
else {
dimensionInfo = dimensions[i];
dimensionName = dimensionInfo.name;
dimensionInfo.type = dimensionInfo.type || 'float'
dimensionInfo.type = dimensionInfo.type || 'number'
}
dimensionNames.push(dimensionName);
dimensionInfos[dimensionName] = dimensionInfo;
......@@ -698,6 +698,10 @@ define(function (require) {
itemVisual[key] = value;
};
var setItemDataAndSeriesIndex = function (child) {
child.seriesIndex = this.seriesIndex;
child.dataIndex = this.dataIndex;
}
/**
* @param {number} idx
* @param {module:zrender/Element} el
......@@ -707,7 +711,10 @@ define(function (require) {
// Add data index and series index for indexing the data by element
// Useful in tooltip
el.dataIndex = idx;
el.seriesIndex = hostModel && hostModel.seriesIndex;
el.seriesIndex = hostModel && hostModel.seriesIndex;;
if (el.type === 'group') {
el.traverse(setItemDataAndSeriesIndex, this)
}
this._graphicEls[idx] = el;
};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册