02-16-2005 11:59 AM
02-16-2005 02:32 PM
02-16-2005 03:37 PM
02-17-2005 08:45 AM
02-17-2005 10:50 AM
02-17-2005 11:03 AM
02-17-2005 11:09 AM
02-17-2005 11:29 AM
03-18-2010 05:19 AM
Hello,
sorry for replying to this old post, but I have a problem regarding exactly this issue.
I use XYRangeAnnotations in a WaveFormGraph to specify some (many) regions.
Each annotation has a caption (should act as label for the annotation) with BoundsAlignment.None.
If the plot is dragged so that the annotation gets clipped, the caption moves away from the annotation (seems that it tries to stay within the plotarea) unless the annotation is completely dragged out of the plotarea. Then the caption also begins moving out of the plotarea.
Even if this might be the desired behavior, I'd like to switch this off! The caption should stay fixed to the desired position relative to its annotation, otherwise I can't figure out which caption belongs to which annotation in some situations. A BoundsAlignment which refers to the annotation instead of the plotarea would be helpful.
Best Regards,
Alex
03-18-2010 07:57 AM
Hey Alex,
This is an interesting problem. There is a tricky way to tackle this. Use the XYRangeAnnotation.SetCaptionPosition(double, double) to set a fixed position for the Caption. Do this in the XAxisRangeChanged and YAxisRangeChanged events on the WaveformGraph. This will keep the caption always relative to what it is pointing to.
Here is the sample code showing the same.
private void waveformGraph2_XAxisRangeChanged(object sender, NationalInstruments.UI.XAxisEventArgs e)
{
// Note here the value 5 is measured in data coordinates (not in pixels).
xyRangeAnnotation1.SetCaptionPosition(5, 5);
}
private void waveformGraph2_YAxisRangeChanged(object sender, NationalInstruments.UI.YAxisEventArgs e)
{
xyRangeAnnotation1.SetCaptionPosition(5, 5);
}
Hope this helps.