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

VictoryBar does not supports passing the categories as a simple array (the documentation + types says that it should works) #2903

Closed
2 tasks done
MangelMaxime opened this issue Sep 23, 2024 · 0 comments · Fixed by #2919
Labels
Issue: Accepted The submitted issue has been confirmed by the Victory core team Type: Bug 🐛 Oh no! A bug or unintentional behavior

Comments

@MangelMaxime
Copy link

MangelMaxime commented Sep 23, 2024

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.1.1

Code Sandbox link

https://codesandbox.io/p/sandbox/victory-starter-forked-mnvscw

Bug report

According to the documentation categories has the following type:

type: array[string] || { x: array[string], y: array[string] }

But using the passing an array of categories to VictoryBar fails with:

Cannot read properties of undefined (reading 'includes')

Steps to reproduce

import { VictoryChart, VictoryBar, VictoryPie } from "victory";

export default function App() {
  return (
    <VictoryChart domainPadding={25}>
      <VictoryPie
        // categories={["birds", "cats", "dogs", "fish", "frogs"]} // Fails
        categories={{ x: ["birds", "cats", "dogs", "fish", "frogs"] }} // Works
        data={[
          { x: "cats", y: 1 },
          { x: "dogs", y: 2 },
          { x: "birds", y: 3 },
          { x: "fish", y: 2 },
          { x: "frogs", y: 1 },
        ]}
      />
    </VictoryChart>
  );
}

Expected behavior

VictoryBar should works with an array of categories

Actual behavior

Fails at runtime

Environment

- Device:
- OS:
- Node:
- npm:
@MangelMaxime MangelMaxime added the Type: Bug 🐛 Oh no! A bug or unintentional behavior label Sep 23, 2024
@carbonrobot carbonrobot added the Issue: Accepted The submitted issue has been confirmed by the Victory core team label Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue: Accepted The submitted issue has been confirmed by the Victory core team Type: Bug 🐛 Oh no! A bug or unintentional behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants