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 login to post comments
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
- Yuriy Zadereckiy answered 11 years ago
-
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 login to post comments
Please login first to submit.