Skip to content

[Bug]: threshold 图例,拖动后图表无法复原 #7121

@moayuisuda

Description

@moayuisuda

Describe the bug / 问题描述

https://g2.antv.antgroup.com/examples/general/cell/#cell-threshold

import { Chart } from '@antv/g2';

const chart = new Chart({
  container: 'container',
  width: 900,
  height: 340,
});

chart
  .cell()
  .data({
    type: 'fetch',
    value:
      'https://gw.alipayobjects.com/os/bmw-prod/89c20fe8-0c6f-46c8-b36b-4cb653dba8ed.json',
    transform: [{ type: 'map', callback: (d) => ({ salary: d }) }],
  })
  .scale('color', {
    type: 'threshold',
    domain: [10000, 100000],
    range: ['#eee', 'pink', 'red'],
  })
  .encode('y', (_, i) => (i % 5) + 1)
  .encode('x', (_, i) => ((i / 5) | 0) + 1)
  .encode('color', 'salary')
  .style('stroke', '#000')
  .style('inset', 2)
  .animate('enter', { type: 'fadeIn' });

chart.render();

这样配置 scale 后,legend 往左拖动改变阈值区间,再往右拖动还原阈值区间,图形不会复原

.scale('color', {
  type: 'threshold',
  domain: [10000, 100000],
  range: ['#eee', 'pink', 'red'],
})

Version / 版本

🆕 5.x

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions