Pre loader

Annotation auto placement to prevent overlapping support?

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

1
0

Using annotations now and it is looking great. Many of my data points have annotations and because of that they frequently overlap even though there is a lot of “free” space in the graph. Does SciChart support out of the box auto placement to prevent box annotations overlapping by moving them to an empty spot and draw an arrow to the x,y coordinate for the annotation?

  • You must to post comments
1
0

I currently have reduced the problem by rotating the annotations to limit the amount of overlap until the client gives a go to move from winforms to wpf ( and SciChart). At the moment just testing out its features and making a relative quick prototype.

The way I was considering doing it is letting the user of scichart define a grid size ( let’s say 10 x 10 ). Then the graph area would have 100 blocks with known size. It would be relatively easy to check if a block is already occupied by an earlier annotation as the placement and size of the earlier annotations are known. If so find a close empty space, which can be fast for a small grid size, and place it there and draw an arrow from there to x,y as defined in the annotation. This has some problems; arrows might be drawn on top of series data, annotations might be to far away from the original x,y for the annotation, too many arrows etc. But it might be a simple way to start.

If the client decides to move to the new platform I’ll give it some more thought and check for existing placement algorithms ( there should be many as auto placement is a common problem in many fields).

Thanks for all the help and great answers.

<s:TextAnnotation x:Class="UserControls.CustomTextAnnotation"
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
         xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
         xmlns:s="http://schemas.abtsoftware.co.uk/scichart"
         mc:Ignorable="d"
         d:DesignHeight="300" d:DesignWidth="300"
         Text="{Binding LabelText}"
         VerticalAnchorPoint="Center"
         HorizontalAnchorPoint="Right"
         FontSize="16"
              RenderTransformOrigin="1.0,0.5"
         X1="{Binding X1}"
         Y1="{Binding Y1}">


<s:TextAnnotation.RenderTransform>
    <TransformGroup>
        <RotateTransform Angle="45"/>
        <TranslateTransform Y="-5"/>
    </TransformGroup>
</s:TextAnnotation.RenderTransform>

  • You must to post comments
0
0

Hi Michel,

No, sorry we don’t have a placement strategy for annotations. They are merely placed at the exact X,Y locations you specify. We do provide virtualisation of annotations, e.g. when out of view, they are not drawn, but when in the viewport, they are always drawn at the locations you specify.

The computational overhead of such an algorithm would be high. However, for small numbers of annotations it might make perfect sense. Do you have any suggestions on how we could implement an algorithm? If so, we could possibly expose an API allowing you to override the placement strategy.

Best regards,
Andrew

  • Matthew Kist
    Hi Andrew, Some sort of API for the placement strategy would be great. I came up with an algorithm for the placement of text + labels, linked by a line, using scatter point markers. I used a scoring method to determine the best placement, then for each point – line – text element, I changed the angle and line length from scatter point to text label, and worked out the best placement. E.g. text overlaps were ranked very bad (a high number), out of the viewport was bad, then things like a long line are a little bit bad. It was fine for scatter point markers because we could draw direct to the context, however I don’t think it’s as easy for text annotations so some sort of API like you mention would be great. It could be good if this included the ability to simply set the visibility of overlapping text annotations to false if overlapping.
  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies