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

【V5】当条形图使用scrollbar时,当拖拽滑块后,无法选择柱状图。 #5619

Closed
18019675002 opened this issue Oct 8, 2023 · 1 comment · Fixed by #5845
Closed

Comments

@18019675002
Copy link

18019675002 commented Oct 8, 2023

【V 5.1.5】当条形图使用scrollbar时,当拖拽滑块后,无法选择柱状图, 请问如何解决?

1.拖拽滚动条前可以选择,并打印出选择的数据
截屏2023-10-08 17 59 16

2.拖动滚动条后,无法选择,并打印的数据是 null
截屏2023-10-08 17 59 44

3.以下是我的代码:

handleBuildChartBack = (container) => {
    const { data } = this.props;
    console.log(data);
    const chart = new Chart({
      container: container,
      autoFit: true,
      title: '商品构成',
    });
    this.chart = chart;
    chart.axis('x', { title: false, label: false }).axis('y', { title: '单量', titleFill: '#5dd3ca' });
    chart
      .interval()
      .style('stroke', '#1296db')
      .style('strokeWidth', '0')
      .data(data)
      .encode('x', 'name')
      .encode('y', 'qty')
      // 滑块设置
      .scrollbar('x', { ratio: 0.3 })
      .scale('y', { nice: true }) // 视图层级的比例尺设置
      .interaction('elementSelect', { single: true }) //
      .state('selected', { fill: 'orange' })
      .state('unselected', { opacity: 0.5 })
      // .state('single', true)
      .label([
        {
          text: 'qty',
          fontSize: 12,
          dy: -15,
        },
        {
          text: 'name',
          position: 'bottom',
          // fill: '#000', // 指定样式
          dy: 0,
          formatter: (text, datum, index, data) => {
            return '';
          },
        },
      ]);
    chart.on('element:select', (event) => {
      const { data, nativeEvent } = event;
      if (nativeEvent) {
        console.log(data);
      }
    });
    chart.render();
    return chart;
  };
@pearmini
Copy link
Member

pearmini commented Oct 9, 2023

可能交互之间有冲突,我看看

@18019675002 18019675002 changed the title 当条形图使用scrollbar时,当拖拽滑块后,无法选择柱状图。 【V5】当条形图使用scrollbar时,当拖拽滑块后,无法选择柱状图。 Oct 11, 2023
@pearmini pearmini added this to the 5.1.7 milestone Oct 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants