SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and now iOS Charting & Android Chart Components

Welcome to the SciChart Community Forums!

Please use the forums below to ask questions about SciChart. Take a moment to read our Question asking guidelines on how to ask a good question and our support policy. We also have a tag=SciChart on Stackoverflow.com where you can earn rep for your questions!

Please note: SciChart team will only answer questions from customers with active support subscriptions. Expired support questions will be ignored. If your support status shows incorrectly, contact us and we will be glad to help.

0
0

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.

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

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

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.

Q2:
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

sciChartBuilder.newVerticalLineAnnotation()
    .withX1(20).withY1(35d).withY2(33d)
    ...

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?

Version
1.2.0
  • You must to post comments
1
0

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,
Yuriy

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.