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

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

Closed
pearmini opened this issue May 16, 2023 · 0 comments · Fixed by #5044
Closed

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

pearmini opened this issue May 16, 2023 · 0 comments · Fixed by #5044
Assignees
Labels

Comments

@pearmini
Copy link
Member

  • 版本:5.0.6

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]] },
  });
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant