Hi,
I'm using a waveform graph, and trying to add annotations when the user double clicks on the graph plot area. I'm using the following code to create and add the annotation:
/// <summary>
/// Add an annotation to represent a feature on the graph
/// </summary>
/// <param name="id">The id of the feature</param>
/// <param name="x">The x value of the feature</param>
/// <param name="y">The y value of the feature</param>
private void AddFeatureAnnotation(int id, double x, double y)
{
NationalInstruments.UI.XYPointAnnotation ann = new NationalInstruments.UI.XYPointAnnotation();
wfgMain.Annotations.Add(ann);
ann.XAxis = this.xAxis1;
ann.XPosition = x;
ann.YAxis = this.yAxis1;
ann.YPosition = y;
ann.ShapeFillColor = Color.Red;
ann.ShapeStyle = ShapeStyle.Diamond;//prob use CreatePolygon to make the cross
ann.ShapeSize = new Size(14, 14);
ann.ToolTipMode = NationalInstruments.UI.AnnotationToolTipMode.None;
ann.ArrowVisible = false;
ann.ArrowColor = Color.Black;
ann.CaptionVisible = btnShowText.Checked;
ann.ArrowHeadStyle = ArrowStyle.None;
ann.CaptionForeColor = Color.Black;
ann.CaptionAlignment = new NationalInstruments.UI.AnnotationCaptionAlignment(NationalInstruments.UI.BoundsAlignment.None, -15F, -20F);
ann.InteractionMode = AnnotationInteractionMode.DragCaption;
ann.Caption = id.ToString();
ann.Tag = id;
}
This works ok, but the problem occurs when multiple annotations have been added- panning becomes very slow and jerky (this is very noticeable even when only one annotation has been added, but when the user has added 5 or so, the panning feature becomes almost unusable). We also have the issue on another waveform graph which has several range annotations (added at design time rather than runtime). When the annotations are not visible, panning works smoothly, but when they are made visible, panning is very jerky.
A typical graph would display between 4000 and 5000 points, but panning is perfectly smooth before any annotations are added. Is this a known issue, and if so are there any workarounds or planned patches?
Cheers,
James