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

🐛 字段标记自定义svg无法修改颜色 #1898

Closed
4 tasks
jzb1205 opened this issue Nov 11, 2022 · 8 comments
Closed
4 tasks

🐛 字段标记自定义svg无法修改颜色 #1898

jzb1205 opened this issue Nov 11, 2022 · 8 comments
Labels
💤 inactive 不活跃的 Issue 或 PR, 30天没有回复

Comments

@jzb1205
Copy link

jzb1205 commented Nov 11, 2022

🏷 Version

| Package | Version |
| -------------- | --------- |
| @antv/s2 | 1.3.1 |
| @antv/s2-react | |
| @antv/s2-vue | |

Sheet Type

  • PivotSheet
  • TableSheet
  • GridAnalysisSheet
  • StrategySheet

🖋 Description

自定义svg无法修改颜色
img_v2_a1805c5d-dae1-4c80-93c8-c2568770aabg

⌨️ Code Snapshots

🔗 Reproduce Link

🤔 Steps to Reproduce

     import { PivotSheet, Node } from '@antv/s2';
    
    fetch(
      'https://gw.alipayobjects.com/os/bmw-prod/cd9814d0-6dfa-42a6-8455-5a6bd0ff93ca.json',
    )
      .then((res) => res.json())
      .then((res) => {
        const container = document.getElementById('container');
        const s2DataConfig = {
          fields: {
            rows: ['province', 'city'],
            columns: ['type', 'sub_type'],
            values: ['number'],
          },
          meta: res.meta,
          data: res.data,
        };
        const s2Options = {
          width: 600,
          height: 480,
          customSVGIcons: [
            {
              name: 'customKingIcon',
              svg: 'https://gw.alipayobjects.com/zos/bmw-prod/f44eb1f5-7cea-45df-875e-76e825a6e0ab.svg',
            },
          ],
          // 使用刚定义的 icon
          conditions: {
            icon: [
              {
                field: 'number',
                position: 'right',
                mapping(value) {
                  return {
                    icon: 'customKingIcon',
                    fill: '#2498D1'
                  }
                }
              }
            ]
          }
        };
        const s2 = new PivotSheet(container, s2DataConfig, s2Options);
    
        // 使用
        s2.render();
      });

😊 Expected Behavior

😅 Current Behavior

💻 System information

@github-actions
Copy link
Contributor

github-actions bot commented Nov 11, 2022

@lijinke666 lijinke666 changed the title 🐛 🐛 字段标记自定义svg无法修改颜色 Nov 11, 2022
@github-actions github-actions bot added the 💤 inactive 不活跃的 Issue 或 PR, 30天没有回复 label Dec 16, 2022
@ab291478089
Copy link

这个bug还没有修复嘛

@1wkk
Copy link
Contributor

1wkk commented Jun 15, 2023

This feature is effective in codesandbox and local environment but not work in S2 Site online example editor.

upd: even I run yarn site:start and latest deployment of pr, it works, too!

cc @lijinke666 @lcx-seima

Maybe this issue can be closed

@ab291478089
Copy link

我在codesandbox试着和本地都不行呢 https://codesandbox.io/s/7ndckq

This feature is effective in codesandbox and local environment but not work in S2 Site online example editor.

upd: even I run yarn site:start and latest deployment of pr, it works, too!

cc @lijinke666 @lcx-seima

Maybe this issue can be closed

@1wkk
Copy link
Contributor

1wkk commented Jun 16, 2023

我在codesandbox试着和本地都不行呢 codesandbox.io/s/7ndckq

This feature is effective in codesandbox and local environment but not work in S2 Site online example editor.
upd: even I run yarn site:start and latest deployment of pr, it works, too!
cc @lijinke666 @lcx-seima
Maybe this issue can be closed

你用的 SVG 的 fill 不能写死,需要是 currentColor,这是 SVG 基础。
示例中的 SVG 中的 fill 是写死数值的🥲

@1wkk
Copy link
Contributor

1wkk commented Jun 16, 2023

localhost_3000_

@ab291478089
Copy link

我在codesandbox试着和本地都不行呢 codesandbox.io/s/7ndckq

This feature is effective in codesandbox and local environment but not work in S2 Site online example editor.
upd: even I run yarn site:start and latest deployment of pr, it works, too!
cc @lijinke666 @lcx-seima
Maybe this issue can be closed

你用的 SVG 的 fill 不能写死,需要是 currentColor,这是 SVG 基础。 示例中的 SVG 中的 fill 是写死数值的🥲

你的意思就是在svg中写死的fill就不做处理了呗 那你告诉我conditions那里icon的fill配置的意义何在?

@lijinke666
Copy link
Member

颜色动态修改只对字符串和本地文件有效, 在线链接不支持

This was referenced Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💤 inactive 不活跃的 Issue 或 PR, 30天没有回复
Projects
None yet
Development

No branches or pull requests

4 participants