Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(interaction): interaction can be clear #5087

Merged
merged 1 commit into from
May 25, 2023
Merged

Conversation

pearmini
Copy link
Member

交互

修复已经添加的交互不能通过 chart.interaction(name, false) 移除的问题。

问题

在更新图表的时候,没有去清空更新为 false 的交互。

案例

export function chartRenderClearInteraction(context) {
  const { container, canvas } = context;

  const chart = new Chart({
    container,
    canvas,
  });

  chart.options({
    theme: 'classic',
    type: 'line',
    clip: true,
    data: {
      type: 'fetch',
      value: 'data/aapl.csv',
    },
    encode: {
      x: 'date',
      y: 'close',
    },
  });

  const finished = chart.render().then(() => {
    chart.options({ interaction: { tooltip: false } }); // 清空 tooltip 交互。
    return chart.render();
  });

  return { chart, finished };
}

@pearmini pearmini requested a review from hustcc May 25, 2023 02:45
@pearmini pearmini merged commit f489fba into v5 May 25, 2023
2 checks passed
@pearmini pearmini deleted the fix/clear-interaction branch May 25, 2023 03:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants