Pre loader

Annotation X and Y value

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums


I am building a real-time graph with CategoryDate X Axis and Numeric Y Axis. I found it hard to understand the Annotation API’s regarding the X and Y positions.

Looking at AnnotationsAreEasyFragment, it draw a Horizontal line of (seemingly) full width. it declares

    .withPosition(7d, 2.8d)
    .withStroke(2, ColorUtil.Orange)

i can under Y = 2.8d, but what is the X=7d for? and in the next Horizontal line which is short, it declares .withPosition(5d, 3.2d)?? X=5d and X=7d gives such a big difference.

Since i am using CategoryDateAxis, referring to InteractionWithAnnotationsFragment to draw a vertical line at a specific date/time, there is a short line vertical line on 3rd Dec with the code


Since its a date axis, i would expect it to accept a Date.class (or long in millis) instead of .withX1(20). It doesnt even make sense! How exactly do i create full height vertical line at a specific date/time?

  • You must to post comments

Hi there,

Thanks for your questions. Concerning setting the X coordinates for a HorizontalLineAnnotation, it depends on the Gravity value set via the setHorizontalGravity() method:
– If it equals to Gravity.FILL_HORIZONTAL, the X coords will be ignored completely.
– for Gravity.CENTER_HORIZONTAL, both X1 and X2 coords will be applied.
– for Gravity.RIGHT / LEFT, only X1 will be applied to the loose end of a line.

As to the second question, such ambiguity occurs because of the nature of CategoryDateAxis. It draws things based on series indexes, not actual Date values. So it is required to convert Date values into Indexes using Axis API. Please refer to the Convert Pixels to Chart Coordinates article for more details.

Hope this clarifies the issues! Please don’t hesitate to ask if it doesn’t,

Best regards,

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.