Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I set the my X axis scale to a custom scale

Thanks for the reply ..

Now how do I set the my X axis scale range on my waveform graph to a custom frequency range. I am measuring a number of frequency points and want label and scale it to these frequencies

Thanks

Joe
0 Kudos
Message 1 of 4
(4,021 Views)
I do not understand exactly what you're trying to do. Could you please provide a little more detail on what you would like the X axis to look like in your application? Thanks.

- Elton
0 Kudos
Message 2 of 4
(4,009 Views)
Thanks for the reply Elton

What I have is an app in VB.Net with a spectrum analyzer capturing power in a certain frequency range and making measurements ever 4 Mhz from 90 to 854 MHZ
I can't seem to figure out how to scale the X axis on my CWGraph to display frequency( 90MHz to 854 MHz)instead of the Number of measurement points 1 - 191

Thanks
0 Kudos
Message 3 of 4
(4,009 Views)
I see. There are several ways to do this, depending on what makes the most sense or what is easiest for your application:


  • Your WaveformGraph is starting at 0 and adding values with an interval of 1 because you are not specifying a start and an increment. You can either call the WaveformGraph.PlotY(yData As Double(), start As Double, increment As Double) overload and specify a different start and increment, or you can set the DefaultStart and DefaultIncrement properties on the WaveformPlot.


  • The WaveformGraph assumes that there is a fixed interval between points. If you would like to explicitly specify the X values (and hence, also the increment), you can use the ScatterGraph instead. See the ScatterGraph(xData As Double(), yData As Double()) method.


  • If the X values are actually 90 and 854 and you want to append MHz to the axis labels, see the XAxis.MajorDivisions.LabelFormat property. For example, you could specify a numeric format string such as "0.00 MHz" (or "0 MHz" if you don't want fractional values).


  • If the X values are actually much larger values and you are using MHz to specify SI units, you can use the XAxis.MajorDivisions.LabelFormat property, but specify an engineering format string. For example, you could specify an engineering format string such as "S'Hz'". Also, be sure to set the format string mode to Engineering since it is Numeric by default.


  • If you can't achieve what you want with format strings and you want custom text labels, you could set the XAxis.MajorDivisions.LabelVisible property to false, then use custom divisions. In this case, you could add two custom divisions, position them at the exact value where you want them to display, set the DisplayStyle to ShowText, then set the Text property to exactly what you want to display at the label.


  • A more advanced option is to create a class that derives from the FormatString class and override FormatDouble. You could implement FormatDouble to return a string representation for any double based on any logic that you like. Once you create your custom FormatString class, you could instantiate it and set it to the XAxis.MajorDivisions.LabelFormat property.


- Elton
0 Kudos
Message 4 of 4
(3,993 Views)