Pre loader

Vertical chart coloring with annotations

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

0
0

Hello,

i have a chart with one x axis and many y axes. What i try to archive is to draw a vertical rectangle over the chart in a specific x-interval but over full Y.

I guess annotations are the solution, i got them working (at least i see them on the chart), but i have questions:

Is it possible to add an annotation without a corresponding Y-Axis? I do not want to connect them to a YAxis since it does not make sense in that case. They should always occupy the full Y range. And, what are the correct Y1 / Y2 values? I tried Double.NegativeInfinity/Double.PositiveInfinity and Double.MinValue/Double.MaxValue but both crashed.

Many thanks,
Robin

  • You must to post comments
0
0

Hi,

There is not any built-in way to achieve this. You need to attach each annotation to particular axis because its position should be evaluated against particular axis. But you could extend existing BoxAnnotation in such a way:

    public class BoxAnnotationEx:BoxAnnotation
    {
        protected override void PlaceAnnotation(AnnotationCoordinates coordinates)
        {
            coordinates.Y1Coord = 0;
            coordinates.Y2Coord = ModifierSurface.ActualHeight;

            base.PlaceAnnotation(coordinates);
        }
    }

..XAML usage:


                <s:BoxAnnotationEx ...
                                 X1="50"
                                 X2="120" />

So you still must attach it to particular Y axis, but don’t need to specify Y1,Y2 coordinates any longer.
In this case, however, you can face resizing issues, although it seems to be unnecessary for your purpose.

Please, let us know if this helps you to achieve desired behavior.

Best regards,
Yuriy

  • Andreas Mueller-Bluemlein
    Hi Yuriy, nice one :) If you mean user-resizing, you are right. These boxes are made to stay forever and cannot be changed by the user. Resizing of the chart / axis etc. seems to work properly, the box always has the maximum Y size. And i will attach it to first axis, which one i take is not important i guess. Many thanks, Robin
  • You must to post comments
Showing 1 result
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