Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

XYCursor with banding

Is there a simple way to draw an XYCursor on a ScatterGraph that can the be set with a number of bands and ranges that will show for the full vertical scale.

It's to show a frequency sweep range with a certain number of frequencies i.e.

centre frequency = 100hz
sweep range = +- 20 hz
num sweeps = 4

would result in the cursor showing centred around 100hz but with 4 pseudo cursors (no point, but lines) either site at 5 hz intervals and have those intervals shaded.

We are currently evaluating the software and this is the first item that I've come across that there doesn't seem to be an immediate solution.

Thanks

Paul
0 Kudos
Message 1 of 5
(4,327 Views)
I would recommend using cursors in conjunction with annotations to accomplish your task at hand. Annotations are a new feature of Measurement Studio 7.1 that was not available with previous versions. If you have the evaluation version of Measurement Studio 7.0, you can also check out new features of Measurement Studio 7.1 user interface controls such as the annotations with the Measurement Studio 7.1 User Interface Feature Tour application. The feature tour does not require any installation on your machine.

The code fragment below demonstrates a solution using cursors and annotations. The example assumes instances of ScatterGraph, XAxis, and YAxis called scatterGraph1, xAxis1, and yAxis1 have been declared and initialized.



// The parameters used for configuring the user interface.
double centreFrequency = 100;
double sweepRange = 20;
int numSweeps = 4;

// Configure centre cursor.
XYCursor centreCursor = new XYCursor();
centreCursor.SnapMode = CursorSnapMode.Fixed;
centreCursor.XPosition = centreFrequency;
centreCursor.HorizontalCrosshairMode = CursorCrosshairMode.None;
centreCursor.PointStyle = PointStyle.None;
centreCursor.PointSize = Size.Empty;

// Add cursor to the graph.
scatterGraph1.Cursors.Add(centreCursor);

int numAnnotations = numSweeps / 2;
double sweepIncrement = sweepRange / numSweeps;
double sweepCount = sweepIncrement;

for (int i = 0; i < numAnnotations; ++i, sweepCount += sweepIncrement)
{
// Configure annotation.
XYRangeAnnotation annotation = new XYRangeAnnotation(xAxis1, yAxis1);
annotation.XRange = new Range(centreCursor.XPosition - sweepCount, centreCursor.XPosition + sweepCount);
annotation.YRange = Range.All;
annotation.RangeFillColor = Color.FromArgb(128, annotation.RangeFillColor);
annotation.ArrowHeadStyle = ArrowStyle.None;
annotation.ArrowLineStyle = LineStyle.None;

// Add annotation to the graph.
scatterGraph1.Annotations.Add(annotation);
}



If you would like the cursor to be interactive, you can set centreCursor.SnapMode to an appropriate value. You will need to attach an event handler to the AfterMove event of the centreCursor. You will also need to move the code block for the configuration and addition of the annotation to a separate method and call this method from the event handler of the AfterMove event.
Abhishek Ghuwalewala | Measurement Studio | National Instruments
0 Kudos
Message 2 of 5
(4,315 Views)
Is there a way to get an eval of this version as looking at a sample program never tells you what you want to know.

Thanks

Paul
0 Kudos
Message 3 of 5
(4,312 Views)
In general, I want to assure you that Measurement Studio 7.1 represents a major improvement over Measurement Studio 7.0 with robust and native .NET libraries. A vast feature set has been added to the user interface libraries including new controls along with significant performance improvements in existing 7.0 controls.

Unfortunately, there is no evaluation version of Measurement Studio 7.1. If you want to look at the API, you can open the assemblies included with the feature tour in Object Browser from within Visual Studio. If this is not satisfactory enough, would it be ok for a National Instruments sales representative to contact you to talk about alternate options?
Abhishek Ghuwalewala | Measurement Studio | National Instruments
0 Kudos
Message 4 of 5
(4,304 Views)
Hey Paul,

If you feel comfortable providing your contact information here, you can post it here and I can contact you directly so we can discuss further options.

Best Regards,
Nate D'Anna
0 Kudos
Message 5 of 5
(4,274 Views)