Skip to content

Accept IConvertible in Annotation.init #78

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

Closed
kentcb opened this issue May 26, 2021 · 4 comments
Closed

Accept IConvertible in Annotation.init #78

kentcb opened this issue May 26, 2021 · 4 comments

Comments

@kentcb
Copy link

kentcb commented May 26, 2021

Description

Annotation.init does not accept IConvertible for X and Y like other APIs.

Repro steps

Try to use a DateTime as the X for Annotation.init, which works fine with other APIs like Shape.init.

Expected behavior

Should be consistent.

Actual behavior

Requires a float.

Known workarounds

Converting to milliseconds since unix epoch and passing that in as a float.

Related information

  • Windows 10
  • 2.0.0-beta9
  • .NET 5

I noticed this problem does not seem unique to the .NET implementation: see here.

@kMutagene
Copy link
Collaborator

Good catch, i am on it right now ;)

@kMutagene
Copy link
Collaborator

Should be fixed in the next version:

let testAnnotation =
    Annotation.init(X=System.DateTime.Now, Y=0,Text="test")

Chart.Line([System.DateTime.Now, 5])
|> Chart.withAnnotations [testAnnotation]
|> Chart.Show

image

@kMutagene
Copy link
Collaborator

Should be fixed in the latest package. Please let me know if there are still problems

@kentcb
Copy link
Author

kentcb commented Jun 1, 2021

Confirmed in preview release - thanks @kMutagene !!

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