chfw commented on a change in pull request #12758:
URL:
https://github.com/apache/incubator-echarts/pull/12758#discussion_r444531215
##########
File path: src/component/axisPointer/viewHelper.js
##########
@@ -60,62 +59,41 @@ export function buildLabelElOption(
);
var labelModel = axisPointerModel.getModel('label');
var paddings = formatUtil.normalizeCssArray(labelModel.get('padding') ||
0);
-
- var font = labelModel.getFont();
- var textRect = textContain.getBoundingRect(text, font);
-
var position = labelPos.position;
- var width = textRect.width + paddings[1] + paddings[3];
- var height = textRect.height + paddings[0] + paddings[2];
-
- // Adjust by align.
- var align = labelPos.align;
- align === 'right' && (position[0] -= width);
- align === 'center' && (position[0] -= width / 2);
- var verticalAlign = labelPos.verticalAlign;
- verticalAlign === 'bottom' && (position[1] -= height);
- verticalAlign === 'middle' && (position[1] -= height / 2);
-
- // Not overflow ec container
- confineInContainer(position, width, height, api);
+ var font = labelModel.getFont();
var bgColor = labelModel.get('backgroundColor');
if (!bgColor || bgColor === 'auto') {
bgColor = axisModel.get('axisLine.lineStyle.color');
}
elOption.label = {
- shape: {x: 0, y: 0, width: width, height: height, r:
labelModel.get('borderRadius')},
+ shape: {},
position: position.slice(),
- // TODO: rich
- style: {
- text: text,
+ style: graphic.setTextStyle({}, labelModel, {
+ text: labelModel.get('show') ? text : null,
+ textBackgroundColor: bgColor,
textFont: font,
- textFill: labelModel.getTextColor(),
textPosition: 'inside',
textPadding: paddings,
- fill: bgColor,
- stroke: labelModel.get('borderColor') || 'transparent',
- lineWidth: labelModel.get('borderWidth') || 0,
- shadowBlur: labelModel.get('shadowBlur'),
- shadowColor: labelModel.get('shadowColor'),
- shadowOffsetX: labelModel.get('shadowOffsetX'),
- shadowOffsetY: labelModel.get('shadowOffsetY')
- },
+ textFill: labelModel.getTextColor(),
+ rotation: labelModel.get('rotate'),
+ opacity: labelModel.get('opacity')
+ }, {isRectText: true}),
// Lable should be over axisPointer.
z2: 10
};
}
// Do not overflow ec container
-function confineInContainer(position, width, height, api) {
- var viewWidth = api.getWidth();
- var viewHeight = api.getHeight();
- position[0] = Math.min(position[0] + width, viewWidth) - width;
- position[1] = Math.min(position[1] + height, viewHeight) - height;
- position[0] = Math.max(position[0], 0);
- position[1] = Math.max(position[1], 0);
-}
+// function confineInContainer(position, width, height, api) {
+// var viewWidth = api.getWidth();
+// var viewHeight = api.getHeight();
+// position[0] = Math.min(position[0] + width, viewWidth) - width;
+// position[1] = Math.min(position[1] + height, viewHeight) - height;
+// position[0] = Math.max(position[0], 0);
+// position[1] = Math.max(position[1], 0);
+// }
Review comment:
Personally, I would delete dead code. That's why we use git for keep
dead codes.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]