12-19-2012 05:01 AM
Hi to all,
Has anyone implemented an object derived from NationalInstruments.UI.YAxis in order to display the MajorDivision and MinorDivisions as 360 angles?
That way, instead of displaying
3
2
1
0
-1
-2
-3
The tick labels would display
3
2
1
0
359
358
357
I guess it would be like adding a new type of String Formatting which would be 'modulo 360'.
If anyone has an idea I would much appreciate any info!
Cheers,
CD
Solved! Go to Solution.
12-19-2012 05:13 AM
I found then answer myself!
I created this class:
Class clNI_CustomFormatString360 Inherits FormatString Private decimals_ As Integer = 0 Public Sub New(ByVal decimals As Integer) MyBase.New(FormatStringMode.Numeric, "G5") decimals_ = decimals End Sub Public Overrides Function FormatDouble(ByVal value As Double) As String While value < 0 value += 360 End While While value >= 360 value -= 360 End While Return MyBase.FormatDouble(Math.Round(value, decimals_)) End Function End Class
And then in my code I assign:
myScatterGraph.YAxes(0).MajorDivisions.LabelFormat = New clNI_CustomFormatString360(1)
That did the trick!