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

Using Cartesian.Ticks doesn't work #25

Open
d3xter opened this issue Jul 22, 2021 · 2 comments
Open

Using Cartesian.Ticks doesn't work #25

d3xter opened this issue Jul 22, 2021 · 2 comments

Comments

@d3xter
Copy link

d3xter commented Jul 22, 2021

When using `Cartesian.Ticks [|...|] on an axis doesn't work and produces the following error:

Failed prop type: Invalid prop ticks of type object supplied to YAxis, expected array

@alfonsogarciacaro
Copy link
Member

Hi @d3xter, thanks for reporting! Sorry, I haven't been used this library for a while. Would it be possible to have some code to reproduce so I can debug the issue?

By the way, just to let you know. There's now Feliz.Recharts which may be more up to date than these bindings.

@alfonsogarciacaro
Copy link
Member

Ah, I remember now we had an issue with arrays in #8. By default Fable compiles numeric arrays as JS Typed Arrays and unfortunately it seems this is not accepted by Recharts. There are two ways to fix this.

  • Pass the --typedArrays false option to Fable 3
  • Use ResizeArray [|1; 2; 3|] which compiles to a "standard" JS array. However, it seems ResizeArray is not compatible with System.Array used in the Ticks signature, so you may use a helper like this:
let ar (xs: 'T seq) = (ResizeArray xs).ToArray()

In any case, maybe we just need to change all the System.Array in the bindings to ResizeArray as we did for ActiveIndex 🤔

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

2 participants