8000 [Feature] 支持brush不改变图元状态的配置 · Issue #4035 · VisActor/VChart · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
[Feature] 支持brush不改变图元状态的配置 #4035
Closed
@skie1997

Description

@skie1997

What problem does this feature solve?

大数据场景下,brush + datazoom缩放在性能一般的机器上会卡顿,期望这种场景下,能够跳过选框与图元的交集检测 和 图元状态更新,以优化性能

function generateCategorizedData(numCategories, pointsPerCategory) {
    const data = [];
    const categories = Array.from({ length: numCategories }, (_, i) => `Category ${i + 1}`);

    for (let category of categories) {
        for (let i = 0; i < pointsPerCategory; i++) {
            const xValue = i + 1; // Sequential x value within each category
            const yValue = Math.floor(Math.random() * 100); // Random y value between 0 and 99
            data.push({ category, x: xValue, y: yValue });
        }
    }

    return data;
}


const categorizedData = generateCategorizedData(10, 2000);
const categorizedData2 = generateCategorizedData(10, 1000)
const spec = {
  type: 'common',
  seriesField: 'color',
  brush:{brushType:'rect', enable:true,zoomAfterBrush:true, inBrush: {
    color: 'red'
  }},
      dataZoom: [
    {
      filterMode: 'filter',
      orient: 'bottom',
      realTime:false
    },
    {
      filterMode: 'filter',
      orient: 'left',
      realTime:false
    }
  ],
  data: [
    {
      id: 'id0',
      values: categorizedData
    },
    {
      id: 'id1',
      values: categorizedData2
    }
  ],
  series: [
    {
      type: 'line',
      id: 'bar',
      dataIndex: 0,
      // label: { visible: true },
      seriesField: 'category',
      dataIndex: 0,
      xField: 'x',
      yField: 'y'
    },
    {
      type: 'line',
      id: 'line',
      dataIndex: 1,
      // label: { visible: true },
      seriesField: 'category',
      xField: 'x',
      yField: 'y',
      stack: false
    }
  ],
  axes: [
    { orient: 'left', seriesIndex: [0] },
    { orient: 'right', seriesId: ['line'], grid: { visible: false } },
    { orient: 'bottom', label: { visible: true }, type: 'band' }
  ],
  legends: {
    visible: true,
    orient: 'bottom'
  },
  tooltip: {
    dimension: {
      visible: false
    }
  }
};

const vchart = new VChart(spec, { dom: CONTAINER_ID });
vchart.renderSync();

// Just for the convenience of console debugging, DO NOT COPY!
window['vchart'] = vchart;

What does the proposed API look like?

updateElementsState?: boolean

Metadata

Metadata

Assignees

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

    0