Skip to content

[Bug]: 使用labelFill来动态设置x轴文字颜色的时候不生效 #2895

@ideaviewes

Description

@ideaviewes

Describe the bug / 问题描述

使用labelFill来动态设置x轴文字颜色的时候不生效

      <Line
        loading={loading}
        animate={null}
        data={data}
        xField={'created_at'}
        yField={'num'}
        shapeField={'smooth'}
        axis={{
          x: {
            labelFill: (created_at: string) => {
              const date = moment(created_at).weekday();
              if (date === 5 || date === 6) {
                return '#ff0000';
              }
              return '#333';
            },
            labelFillOpacity: 1,
          },
        }}
        slider={{
          x: {},
        }}
      />

在控制台输出color,是正常的,但是显式的颜色都是#333

Reproduction link / 复现链接

No response

Steps to Reproduce the Bug or Issue / 重现步骤

No response

Version / 版本

@ant-design/charts 版本:2.2.7
@ant-design/plots 版本:2.3.3

Please select / 请选择

OS / 操作系统

  • macOS
  • Windows
  • Linux
  • Others / 其他

Browser / 浏览器

  • Chrome
  • Edge
  • Firefox
  • Safari (Limited support / 有限支持)
  • IE (Nonsupport / 不支持)
  • Others / 其他

Metadata

Metadata

Assignees

No one assigned

    Labels

    G2G2问题waiting for maintainerTriage or intervention needed from a maintainer

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions