LesterWeng opened a new issue #11257: 'textAlign' doesn't work while using 'svg' renderer URL: https://github.com/apache/incubator-echarts/issues/11257 Version 4.2.1 Steps to reproduce 1. set render: this.waterfall = echarts.init( this.$el.querySelector(".content-waterfall"), undefined, { renderer: "svg" } ) 2. set text option: this.waterfall.setOption({ tooltip: { trigger: "item" }, xAxis: { type: "time", splitLine: { show: false }, position: "top", splitNumber: 20, min: this.startTime.toDate().getTime(), max: this.endTime.toDate().getTime() }, grid: { left: "20", right: "20", containLabel: true }, yAxis: { inverse: true, show: false, type: "category" }, series: [ { type: "custom", encode: { x: [1, 2], y: 0 }, renderItem: (params, api) => { const categoryIndex = api.value(0); const start = api.coord([api.value(1), categoryIndex]); const end = api.coord([api.value(2), categoryIndex]); const height = 12; const rectShape = echarts.graphic.clipRectByRect( { x: start[0], y: start[1] - height / 2, width: end[0] - start[0], height: height }, { x: params.coordSys.x, y: params.coordSys.y, width: params.coordSys.width, height: params.coordSys.height } ); let textAlign, position; const min = this.startTime.toDate().getTime(), max = this.endTime.toDate().getTime(); if (api.value(1) - min >= max - api.value(2)) { textAlign = 'right'; position = [start[0] - 5, start[1]]; } else { textAlign = 'left'; position = [end[0] + 5, end[1]]; } return { type: "group", children: [ { type: "rect", shape: rectShape, style: api.style() }, { type: "text", silent: true, style: { text: api.value(3), textAlign, textVerticalAlign: "middle" }, position } ] }; }, data: data.map((t, index) => { return { value: [ index, t.missionStartTimestamp, t.missionEndTimestamp, t.missionName, t.missionId ], itemStyle: { color: COLOR_MAP[t.missionColorType] }, // label: { // show: true, // color: "#000", // formatter(params) { // // 超过10个文字缩略展示 // return params.value[3].length > 10 // ? params.value[3].slice(0, 11) + "..." // : params.value[3]; // }, // position: this.getMissionNamePosition(t) // }, tooltip: { show: true, formatter(params) { return params.value[3]; } } }; }) } ] }); What is expected? while set 'left': 'text-anchor' of the text tspan shoud be 'start' and set 'right': 'text-anchor' of the text tspan shoud be 'end' What is actually happening? sometimes result is all 'start' and sometimes result is all 'end'
---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@echarts.apache.org For additional commands, e-mail: commits-h...@echarts.apache.org