Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Derived YAxis for 360 angles

Solved!
Go to solution

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

0 Kudos
Message 1 of 2
(5,225 Views)
Solution
Accepted by topic author cdouillet

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!

0 Kudos
Message 2 of 2
(5,223 Views)