Skip to content

表格字体支持倾斜和下划线吗 #2384

Closed Answered by lijinke666
KuduroJS asked this question in Q&A
Discussion options

You must be logged in to vote

下划线需要自行在文本下分绘制一条线, 可以参考链接跳转的实现自定义单元格, 在单元格的文字下方绘制, 或者直接使用 S2 内置的 链接跳转, 默认就会绘制下划线, https://s2.antv.antgroup.com/examples/interaction/advanced/#pivot-link-jump

this.linkFieldShape = renderLine(
this,
{
x1: startX,
y1: maxY + 1,
x2: startX + this.actualTextWidth, // 不用 bbox 的 maxX,因为 g-base 文字宽度预估偏差较大
y2: maxY + 1,
},
{ stroke: linkFillColor, lineWidth: 1 },
);

字体倾斜, 配置文本主题的 fontStyle: "italic" 即可, 文档有遗漏, 后续补充

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by KuduroJS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants