Skip to content

[Bug] The updateSpec method does not handle the globalScale, cause color is not updated #216

@kkxxkk2019

Description

@kkxxkk2019

Version

1.0.0

Link to Minimal Reproduction

none

Steps to Reproduce

  const spec = {
    type: 'pie',
    categoryField: '20001',
    valueField: '230718111907021',
    data: [
      {
        id: 'data',
        values: [
          {
            '20001': '消费者',
            '230718111907021': 8025072,
            '230718111907024': '消费者'
          },
          {
            '20001': '公司',
            '230718111907021': 5152793,
            '230718111907024': '公司'
          },
          {
            '20001': '小型企业',
            '230718111907021': 2891088,
            '230718111907024': '小型企业'
          }
        ],
        transform: [
          {
            type: 'fields',
            options: {
              fields: {
                '20001': {
                  alias: '图例项 ',
                  domain: ['消费者', '公司', '小型企业']
                },
                '230718111907021': {
                  alias: '销售额'
                },
                '230718111907024': {
                  alias: '细分'
                }
              }
            }
          }
        ]
      }
    ],
    groupBy: '20001',
    color: {
      field: '20001',
      type: 'ordinal',
      range: ['#212121', '#656565', '#8ec8ac'],
      specified: {
        消费者: '#f5222d',
        公司: '#7953CB',
        小型企业: '#81c87c'
      }
    }
  };

  const vchart = new VChart(spec, { dom: document.getElementById('chart') as HTMLElement });
  vchart.renderAsync();

  // 只为了方便控制台调试用,不要拷贝
  window['vchart'] = vchart;
  setTimeout(() => {
    vchart.updateSpec({
      type: 'pie',
      categoryField: '20001',
      valueField: '230718111907021',
      data: [
        {
          id: 'data',
          values: [
            {
              '20001': '消费者',
              '230718111907021': 1000000,
              '230718111907024': '消费者'
            },
            {
              '20001': '公司',
              '230718111907021': 5152793,
              '230718111907024': '公司'
            },
            {
              '20001': '小型企业',
              '230718111907021': 2891088,
              '230718111907024': '小型企业'
            }
          ],
          transform: [
            {
              type: 'fields',
              options: {
                fields: {
                  '20001': {
                    alias: '图例项 ',
                    domain: ['消费者', '公司', '小型企业']
                  },
                  '230718111907021': {
                    alias: '销售额'
                  },
                  '230718111907024': {
                    alias: '细分'
                  }
                }
              }
            }
          ]
        }
      ],
      groupBy: '20001',
      color: {
        field: '20001',
        type: 'ordinal',
        range: ['yellow', 'red', 'black'],
        specified: {
          消费者: '#f5222d',
          公司: '#7953CB',
          小型企业: '#81c87c'
        }
      }
    });
  }, 2000);

Current Behavior

the color does not work.

Expected Behavior

work

Environment

- OS:
- Browser:
- Framework:

Any additional comments?

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions