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


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

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"
         d:DesignHeight="300" d:DesignWidth="300"
         Text="{Binding LabelText}"
         X1="{Binding X1}"
         Y1="{Binding Y1}">

        <RotateTransform Angle="45"/>
        <TranslateTransform Y="-5"/>

  • You must to post comments

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,

  • 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.