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

Tooltip does not work #3011

Closed
2 tasks done
ved-asole opened this issue Dec 14, 2024 · 2 comments
Closed
2 tasks done

Tooltip does not work #3011

ved-asole opened this issue Dec 14, 2024 · 2 comments
Labels
Type: Bug 🐛 Oh no! A bug or unintentional behavior

Comments

@ved-asole
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Code of Conduct

  • I agree to follow this project's Code of Conduct

Victory version

37.3.4

Code Sandbox link

No response

Bug report

When using VictoryTooltip component in react then getting the below error:


react.development.js:1407 Uncaught SyntaxError: The requested module '/node_modules/lodash/isPlainObject.js?v=5702a64a' does not provide an export named 'default' (at victory-tooltip.js:5:8)


### Steps to reproduce

```markdown
1. Install victory v37.3.4 in react+vite project.
2. Import VictoryToolTip like below and use it :

import { VictoryTooltip } from '../../../node_modules/victory-tooltip/es/victory-tooltip';


3. Total chart I'm using :

<VictoryChart
          colorScale={'warm'}
          width={500}
          height={250}
          animate={{ duration: 2000, easing: "bounce" }}
          title='Total Income'
          theme={VictoryTheme.material}
          padding={{ top: 10, bottom: 60, left: 80, right: 20 }}
          domainPadding={{ y: 30, x: 30 }}
        >
          <VictoryLine
            data={totalIncomeByMonth.map((data) => {
              data.date = new Date(data.date).toDateString()
                .split(' ')[1]
                .concat(' ')
                .concat(new Date(data.date).getFullYear());
              return { x: String(data.date), y: data.income }
            })}
            labelComponent={<VictoryTooltip />}
            style={{
              data: { stroke: "#c43a31" },
              parent: { border: "1px solid #ccc" },
            }}
            animate={{
              duration: 2000,
              onLoad: { duration: 1000 }
            }}
          />
          <VictoryAxis
            animate={true}
            style={{
              tickLabels: { fill: "grey" },
              axis: { stroke: 'grey' },
              grid: { stroke: "lightgrey" }
            }}
          />
          <VictoryAxis
            animate={true}
            dependentAxis
            style={{
              tickLabels: { fill: "grey" },
              axis: { stroke: 'grey' },
              grid: { stroke: "lightgrey" },
            }}
          />
          {/* <VictoryTooltip
            flyoutStyle={{ stroke: "tomato", strokeWidth: 1 }}
            style={{ fill: "black" }}
          /> */}
        </VictoryChart>

Expected behavior

The module should be imported properly and should show tooltip on the chart

Actual behavior

Getting error :

react.development.js:1407 Uncaught SyntaxError: The requested module '/node_modules/lodash/isPlainObject.js?v=5702a64a' does not provide an export named 'default' (at victory-tooltip.js:5:8)

Environment

- Device:Desktop
- OS:Ubuntu
- Node:v20.18.1
- npm:10.8.2
@ved-asole ved-asole added the Type: Bug 🐛 Oh no! A bug or unintentional behavior label Dec 14, 2024
@carbonrobot
Copy link
Contributor

Please try correcting your import to the following, which will point your build system at the correct export.

import { VictoryTooltip } from 'victory';

@ved-asole
Copy link
Author

Thanks it fixed the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug 🐛 Oh no! A bug or unintentional behavior
Projects
None yet
Development

No branches or pull requests

2 participants