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(brush): upper bound for selection #5044

Merged
merged 1 commit into from
May 16, 2023
Merged

fix(brush): upper bound for selection #5044

merged 1 commit into from
May 16, 2023

Conversation

pearmini
Copy link
Member

fix: #5028

image

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

export const data = [
  { date: '2001-01', value: 100 },
  { date: '2001-02', value: 400 },
  { date: '2001-03', value: 500 },
  { date: '2001-04', value: 600 },
  { date: '2001-05', value: 300 },
  { date: '2001-06', value: 600 },
  { date: '2001-07', value: 300 },
  { date: '2001-08', value: 600 },
  { date: '2001-09', value: 109 },
  { date: '2001-10', value: 100 },
  { date: '2001-11', value: 102 },
  { date: '2001-12', value: 103 },
  { date: '2002-01', value: 102 },
  { date: '2002-02', value: 101 },
  { date: '2002-03', value: 200 },
  { date: '2002-04', value: 500 },
  { date: '2002-05', value: 100 },
  { date: '2002-06', value: 100 },
  { date: '2002-07', value: 102 },
  { date: '2002-08', value: 109 },
];

const chart = new Chart({
  container: 'container',
  theme: 'classic',
  paddingBottom: 80,
});

chart
  .interval()
  .data(data)
  .encode('x', 'date')
  .encode('y', 'value')
  .interaction('brushXHighlight', true);

chart.render().then((chart) => {
  const X = ['2001-01', '2001-03'];
  chart.emit('brush:highlight', {
    data: { selection: [X, [-Infinity, Infinity]] },
  });
});

@pearmini pearmini requested review from hustcc and lvisei May 16, 2023 14:07
@hustcc hustcc merged commit b6ea831 into v5 May 16, 2023
@hustcc hustcc deleted the fix/brush-highlight branch May 16, 2023 22:42
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.

chart.emit('brushHighlight') 框和高亮颜色不匹配
2 participants