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

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.