Pre loader

Line annotations && labels

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

Closed
0
0

Hello,
We are creating a stock chart and are currently at the stage of adding various formations. So far, we have added: trend line (LineAnnotation), vertical and horizontal lines, and a horizontal ray (HorizontalLineAnnotation with x1). We still need the most popular and commonly used formation: the extended line – which is simply a straight line that extends across the entire chart, and its position and angles can be adjusted.

Here’s a link with an example of how it works: https://docs.anychart.com/Stock_Charts/Drawing_Tools_and_Annotations/Infinite_Line
Is it possible to create such a line, or is it currently not supported?

Additionally, the ability to add labels only works in HorizontalLineAnnotation and VerticalLineAnnotation. Will the ability to add labels in LineAnnotation be added?

Best regards,
Kamil

Version
3.4.652
  • You must to post comments
0
0

Hello,
I believe it is possible to implement the adjustable line with a few Annotations.
There might be some challenges though.
Consider this:
– Annotations support dragging (and resizing) – enable isEditable property
– it is possible to customize adorner highlighting styles that appear in the edit mode
– SciChartSurface intercepts mouse events;
so they could be accessed from a Chart Modifier or drag callbacks on an annotation
– currently, adding some styles upon hover would require adding an AnnotationHoverModifier
– LineAnnotation is not infinite, but you can adjust the endpoints dynamically

Regarding line labels, I believe these could be replicated with AxisMarkerAnnotations.
I’m not sure about adding this to the library as it is a bit unclear to me what should they display.
But you can always vote for a new feature via the request form.

Also, we are working on some improvements to the Annotations API planned in v4.

  • You must to post comments
0
0

Hi,
thanks for the anwser.

Regarding the lines, in every case, we’re using the isEditable property. There are more issues, though. I can’t set dragPoints in the middle of the line – if I have the chart zoomed out to the maximum, create a line, then zoom in, I have to zoom out again to rotate the line, resize it, zoom in, and so on. The goal is to be able to rotate it regardless of the zoom level.
I was thinking of creating two lines with the same id. One would be editable, the other not, and during onDrag, we would recalculate the position of the second line, but there are several issues with that approach too.

We’ll probably decide to vote for a new feature.

Regarding the label, the idea is that the user should be able to edit the labels of all lines and, with the press of one button, hide/show them – I wanted to use showLabel for this. The text only needs to be positioned above the line, as it is with vertical or horizontal lines. But in that case, we’ll probably give up on showLabel, and the user will add textAnnotations individually without the option to hide them.

Images
  • You must to post comments
0
0

It is possible to set custom drag points.
However, a better solution would be to add 2 extra annotations instead (e.g. BoxAnnoation like in the provided example).
Then based on their position you can calculate the line equation and adjust the line segment end coordinates according to the max visible range.

Sorry, I’ve got a bit confused before regarding the labels as we have different options for their positioning.
You could try to implement it with an SVG using CustomAnnotion.

  • You must to post comments
Showing 3 results