Skip to content

Accept IConvertible in Annotation.init #78

Description

@kentcb

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.

Activity

  1. kMutagene commented on May 27, 2021

    @kMutagene
    Collaborator

    Good catch, i am on it right now ;)

  2. kMutagene commented on May 27, 2021

    @kMutagene
    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

  3. kMutagene commented on May 31, 2021

    @kMutagene
    Collaborator

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

  4. kentcb commented on Jun 1, 2021

    @kentcb
    Author

    Confirmed in preview release - thanks @kMutagene !!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions