Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

How to make Autospacing when using Custom Division of .NET waveform graph?

I used x-axis custom division of .NET waveform graph in order to plot 1/3 Octave spectrum as shown in attached picture. It works okay, but the spacing is not adjusted automatically. I checked autospacing property of XAxis collection, but it is set true. How can I make it?

I used 32-band custom frequencies. The following code shows how I added my custom scales.

private string [] freqDef = {"20","25","31.5","40","50","63","80","100","125","160",
"200","250","315","400","500","630","800","1k","1.25k","1.6k",
"2k","2.5k","3.15k","4k","5k","6.3k","8k","10k","12.5k","16k","20k","Total"};

// Define Custom Scale
AxisCustomDivision uiItem;
for (int m=this.iStartFreq; m<(iStartFreq+nAvgOctBnd-1); m++)
{
uiItem = new AxisCustomDivision((double)m,freqDef[m],CustomDivisionDisplayStyle.ShowText);
uiItem.TickColor = Color.Black;
wGraph.XAxes[0].CustomDivisions.Add(uiItem);
}

Thank you very much.
0 Kudos
Message 1 of 2
(3,302 Views)
The AutoSpacing property only applies to the major and minor divisions, not the custom divisions. One option is to add every other division, cutting the number of labels in half so that they don't overlap. Another option is to change the tick length of every other division to be longer so that the label will be pushed down and not overlap with the adjacent divisions. You could also add all of the divisions, then change the Visible property of the divisions depending on the x axis range and the size of the plot area (as specified by the graph's PlotAreaBounds property) so that the labels don't overlap. The graph provides PlotAreaBoundsChanged and XAxisRangeChanged events that you could handle to manage this.

- Elton
0 Kudos
Message 2 of 2
(3,275 Views)