Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

漏斗图标签在重复渲染后,最后一行的标签显示会被遮挡 #2708

Closed
xiao15934831580 opened this issue Jul 28, 2020 · 9 comments
Labels

Comments

@xiao15934831580
Copy link

  • G2 Version:4.0.12
  • Platform:
  • Mini Showcase(like screenshots):
  • CodePen Link:

使用 chart.annotation().text()绘制在漏斗图funnel上边的content,在切换标签显示后,最后一行的interval 上边显示的content被半透明遮挡,怎么解决

@xiaobindebingo
Copy link
Contributor

把你可以复现这个bug的demo贴出来?

@xiao15934831580
Copy link
Author

const { DataView } = DataSet;
const dv = new DataView().source([
{ action: '浏览网站', pv: 50000 },
{ action: '放入购物车', pv: 35000 },
{ action: '生成订单', pv: 25000 },
{ action: '支付订单', pv: 15000 },
{ action: '完成交易', pv: 8000 },
]);
dv.transform({
type: 'map',
callback(row) {
row.percent = row.pv / 50000;
return row;
},
});
const data = dv.rows;
chart.annotation().clear(true);
data.forEach((value) => {
let contentValue: string = '';
let displayData = value.pv;
for (let setting of this.chartStyle.seriesSetting) {
if (setting.measureModel == value.action) {
switch (this.chartStyle.labelDisplay) {
case '度量值':
contentValue = displayData;
break;
case '转化率+度量值':
contentValue = displayData + ' ' + displayData*100 + '%';
break;
}
// 重新配置辅助文本
chart.annotation().text({
top: true,
position: {
action: value.action,
percent: 'median',
},
content: setting.measureAlias + ':' + contentValue, // 显示的文本内容
style: {
stroke: null,
fill: "#fff",
fontSize: '12',
textAlign: 'center',
shadowBlur: 2,
shadowColor: 'rgba(0,0,0,0.2)',
},
});
}
}
});
chart.render();

@xiaobindebingo
Copy link
Contributor

const { DataView } = DataSet;
const dv = new DataView().source([
{ action: '浏览网站', pv: 50000 },
{ action: '放入购物车', pv: 35000 },
{ action: '生成订单', pv: 25000 },
{ action: '支付订单', pv: 15000 },
{ action: '完成交易', pv: 8000 },
]);
dv.transform({
type: 'map',
callback(row) {
row.percent = row.pv / 50000;
return row;
},
});
const data = dv.rows;
chart.annotation().clear(true);
data.forEach((value) => {
let contentValue: string = '';
let displayData = value.pv;
for (let setting of this.chartStyle.seriesSetting) {
if (setting.measureModel == value.action) {
switch (this.chartStyle.labelDisplay) {
case '度量值':
contentValue = displayData;
break;
case '转化率+度量值':
contentValue = displayData + ' ' + displayData*100 + '%';
break;
}
// 重新配置辅助文本
chart.annotation().text({
top: true,
position: {
action: value.action,
percent: 'median',
},
content: setting.measureAlias + ':' + contentValue, // 显示的文本内容
style: {
stroke: null,
fill: "#fff",
fontSize: '12',
textAlign: 'center',
shadowBlur: 2,
shadowColor: 'rgba(0,0,0,0.2)',
},
});
}
}
});
chart.render();

你的chart实例化也贴出来吧

@xiao15934831580
Copy link
Author

https://codepen.io/leungwensen/pen/WXJgox
但是在demo中没有复现出来,在实际项目中出现最后一条content被遮挡

@xiao15934831580
Copy link
Author

@xiaobindebingo
Copy link
Contributor

demo链接 https://codepen.io/xiao15934831580/pen/dyGELLb

image
什么也看不到呢

@xiao15934831580
Copy link
Author

@xiaobindebingo
Copy link
Contributor

这个链接 https://codepen.io/xiao15934831580/pen/dyGELLb

能否将你在项目中被覆盖的效果图贴出来,如果复现不了,是不是有可能是你自己布局的问题?

@hustcc hustcc added the Invalid label Jan 29, 2021
@hustcc
Copy link
Member

hustcc commented Jan 29, 2021

@xiao15934831580 可以波给出最简的 bug 复现 demo。

@xiaobindebingo 心累

@hustcc hustcc closed this as completed Aug 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants