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

🐛[分组条形图] Cannot read properties of undefined (reading 'visible') #2502

Open
ytanck opened this issue Apr 15, 2024 · 0 comments
Open

Comments

@ytanck
Copy link

ytanck commented Apr 15, 2024

分组条形图,当鼠标hover时报错:
tooltip.js:364 Uncaught TypeError: Cannot read properties of undefined (reading 'visible')
at getTooltipItemsByFindData (tooltip.js:364:1)
at findItemsFromView (tooltip.js:425:1)
at push../node_modules/@antv/g2plot/node_modules/@antv/g2/esm/chart/controller/tooltip.js.Tooltip.findItemsFromView (tooltip.js:650:1)
at push../node_modules/@antv/g2plot/node_modules/@antv/g2/esm/chart/controller/tooltip.js.Tooltip.getTooltipItems (tooltip.js:259:1)
at push../node_modules/@antv/g2plot/node_modules/@antv/g2/esm/chart/controller/tooltip.js.Tooltip.showTooltip (tooltip.js:62:1)
at push../node_modules/@antv/g2plot/node_modules/@antv/g2/esm/chart/view.js.View.showTooltip (view.js:856:1)
at push../node_modules/@antv/g2plot/node_modules/@antv/g2/esm/interaction/action/component/tooltip/geometry.js.TooltipAction.showTooltip (geometry.js:63:1)
image

代码示例

import { Column } from '@ant-design/plots';

const config = {
    data: chartsData,
    xField: xField,
    yField: yField, 
    seriesField: 'calendarDate',
    isGroup: true,
    maxColumnWidth: 50,
    label: {
      position: 'middle', // 'top', 'bottom', 'middle',
      style: {
        fill: '#FFFFFF',
        opacity: 1
      },
      formatter: (text, item, index) => {
        if (text.calendarDate)
          text.calendarDate = moment(text.calendarDate).format('MM/DD');
      }
    },
    xAxis: {
      label: {
        autoHide: true,
        autoRotate: false
      }
    },
  return <Column {...config} />;

© 版本信息

  • 版本:
    • "@ant-design/charts": "^1.4.2",
    • "@ant-design/plots": "^1.2.5",
    • "react": "^16.8.6",
  • node:16.15.0
  • 开发环境 [win10]

有时候正常,大部分时候报错

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

No branches or pull requests

1 participant