Giter VIP home page Giter VIP logo

Comments (2)

github-actions avatar github-actions commented on May 25, 2024

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

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

from s2.

lijinke666 avatar lijinke666 commented on May 25, 2024

自定义icon能否支持多个icon

你指的 [自定义 icon] 是行列头 (headerActionIcons) 还是字段标记 (conditions) ? 前者是支持的, 字段标记确实不支持, 会考虑在 2.0 版本中迭代 (增加多个 icon 和自定义 position 的能力), 目前的方案可以参考下文.

期望能提供单元格右上角添加tag

表格是 Canvas, 目前你可以自定义 DataCell, 然后自己在右上角绘制一个 icon 或者一个图形, 数值左右绘制多个 icon 也可以通过这种方式.

import { PivotSheet, DataCell, renderIcon } from '@antv/s2';

class CustomDataCell extends DataCell {
  initCell() {
    super.initCell()

    this.drawIcon()
  }

  drawIcon() {
    const { width, height, x, y } = this.meta
    const size = 12

    // 当前文本宽度 this.actualTextWidth, 你可以结合 meta 计算坐标自行绘制多个 icon
    if(this.meta.fieldValue === 7789) {
      const icon = renderIcon(this, {
        x: width - size,
        y: y,
        // 内置或者通过 customSVGIcons 注册的 icon 名
        name: 'Plus',
        width: size,
        height: size,
        fill: 'red'
      })

      icon.on('click', () => {
        console.log('...')
      })
    }
  }
}

image

from s2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.