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

Exception in CartesianChart with BarGroup when Data array is empty #439

Open
3 tasks done
wrldh opened this issue Dec 5, 2024 · 3 comments
Open
3 tasks done

Exception in CartesianChart with BarGroup when Data array is empty #439

wrldh opened this issue Dec 5, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@wrldh
Copy link

wrldh commented Dec 5, 2024

Prerequisites

  • I have searched the open issues to make sure I'm not opening a duplicate issue
  • I have read through the docs before asking a question
  • I am using the latest version of victory-native-xl

Describe Your Environment

What version of victory-native-xl are you using? 41.12.2

What version of React and React Native are you using? react 18.2.0, react-native 0.73.9

What version of Reanimated and React Native Skia are you using? react-native-reanimated 3.12.1, @shopify/react-native-skia 1.5.10

Are you using Expo or React Native CLI? React Native CLI

What platform are you on? iOS

Describe the Problem

Let's use the example of BarGroup from here https://commerce.nearform.com/open-source/victory-native/docs/cartesian/bar/bar-group#example, but set [] instead of DATA. It works.

<CartesianChart
  data={[]}
  xKey='x'
  yKeys={['y', 'z']}
  >
  {({ points, chartBounds }) => (
    <BarGroup chartBounds={chartBounds} betweenGroupPadding={0.3} withinGroupPadding={0.1}>
      <BarGroup.Bar points={points.y} color='red' />
      <BarGroup.Bar points={points.z} color='blue' />
    </BarGroup>
  )}
</CartesianChart>

But as soon as you add axisOptions or xAxis/yAxis to CartesianChart properties, this example starts to failing with Exception in HostFunction: Value is undefined, expected a number.

<CartesianChart
  data={[]}
  xKey='x'
  yKeys={['y', 'z']}
  axisOptions={{
    lineColor: '#000000',
    labelColor: '#000000',
  }}
  >
  {({ points, chartBounds }) => (
    <BarGroup chartBounds={chartBounds} betweenGroupPadding={0.3} withinGroupPadding={0.1}>
      <BarGroup.Bar points={points.y} color='red' />
      <BarGroup.Bar points={points.z} color='blue' />
    </BarGroup>
  )}
</CartesianChart>

Additional Information

Screenshot 2024-12-05 at 19 14 20
@Decezaris
Copy link

Same problem here!

@zibs zibs added the bug Something isn't working label Dec 18, 2024
@zibs
Copy link
Contributor

zibs commented Dec 18, 2024

We'll take a look

@arafat813
Copy link

Other charts also have the same error, and the version is 41.14.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants