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

antv [email protected] 使用customTree 目录树时,想通过conditions配置表头的样式,使用后发现,插件内部生成的row【指标】这一格无法修改,利用什么属性可以修改 #2860

Closed
zj-93 opened this issue Aug 14, 2024 · 2 comments
Assignees
Labels
❔question 疑问/使用问题

Comments

@zj-93
Copy link

zj-93 commented Aug 14, 2024

| Package | Version |
| @antv/s2 | 1.49.1 |

PivotSheet

🖋 Description

'Snipaste_2024-08-14_10-36-29'
使用hierarchyType: customTree 目录树时,想通过conditions配置表头的样式,使用后发现,插件内部生成的row【指标】这一格无法修改

🔗 Reproduce Link

https://s2-v1.antv.antgroup.com/zh/examples/custom/custom-tree/#custom-tree
const s2Options = {
width: 600,
height: 480,
hierarchyType: 'customTree',
conditions: {
text: [
{
field: 'custom-node-1',
mapping(value) {
return {
fill: 'red',
};
},
},
],
background: [
{
field: 'type',
mapping(value) {
return {
fill: 'red',
};
},
},
{
field: 'sub_type',
mapping(value) {
return {
fill: 'red',
};
},
},
{
field: 'measure-a',
mapping(value) {
return {
fill: 'red',
};
},
},
],
},
};

😊 Expected Behavior

如何可以修改row【指标】这一格样式

😅 Current Behavior

@zj-93 zj-93 added the ❔question 疑问/使用问题 label Aug 14, 2024
Copy link
Contributor

你好 @zj-93,请编辑你的 issue 标题, 一个言简意赅的 issue 标题可以节省大家的时间, 请不要将标题当做正文, 或者为空。

Hello, @zj-93, please edit your issue title. a concise issue title will save everyone time. please do not leave the title as the body or empty.

@zj-93 zj-93 changed the title 🤔 antv [email protected] 使用customTree 目录树时,想通过conditions配置表头的样式,使用后发现,插件内部生成的row【指标】这一格无法修改,利用什么属性可以修改 Aug 14, 2024
@lijinke666
Copy link
Member

conditions 是用于字段标记的场景, 如果你只是想定制表头样式, 请考虑 主题配置自定义单元格

[指标] 对应的单元格类型为 角头 (CornerCell)

s2.setTheme({
  cornerCell: {
    cell: { ... },
    text: {...}
  }
})
class CustomCornerCell extends CornerCell {
  getBackgroundColor() {
    console.log(this.meta)
    return {
      backgroundColor: 'red',
      backgroundColorOpacity: 0.2,
    };
  }
}

@lijinke666 lijinke666 self-assigned this Aug 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
❔question 疑问/使用问题
Projects
None yet
Development

No branches or pull requests

2 participants