Android Question xGraph Class and b4xlib - Not siplaying line graph traces when Manual Scaling selected.

rgarnett1955

Active Member
Licensed User
Longtime User
Hi,

Trying to use xGraph to display Power Line Voltage and frequency, but when I select manual scaling and provide the ranges the graphs don't display the lines.

The cursors show the data points as I expect they get these from the y Value arrays.

This is my function with test data:

B4X:
Private Sub InitGraphX1
    Private i As Int
   
    xGraph1.CurveYName(0) = "Voltage RMS"
    xGraph1.SetScaleManu(0, 220, 270)
    xGraph1.CurveYName(1) = "Frequency Hz"
    xGraph1.SetScaleManu(1, 48.5, 51.5)
   
    xGraph1.CurvesToDisplay.Initialize2(Array As Int(0, 1))
   
    Private x0 = -120 * 30 As Int
    Samples = NWServ.NO_SAMPLES
    xGraph1.NbSamples = Samples + 1
    For i = 0 To Samples
        xGraph1.CurveX(i) = (i + x0) / 30
        xGraph1.CurveY(0, i) = 1 * SinD(i * 0.1) + 247
        xGraph1.CurveY(1, i) = 0.1 * CosD(i * 0.1)
    Next
   

'    xGraph1.Title = "Test"
'    xGraph1.SetZoomIndexes(5, 295)
'    xGraph1.ScaleYValues = "1!3!10"
'    xGraph1.DisplayCurveUnit = False
'    xGraph1.DisplayCurveIndex = False

    xGraph1.DrawGraph
End Sub

Works fine on auto, but I don't want auto on this data as I want a consistent scaling that does not confuse the operator.

Best regards

Rob
 

Attachments

  • Snag_1068a1b1.png
    Snag_1068a1b1.png
    52.2 KB · Views: 285

rgarnett1955

Active Member
Licensed User
Longtime User
Hi,

Trying to use xGraph to display Power Line Voltage and frequency, but when I select manual scaling and provide the ranges the graphs don't display the lines.

The cursors show the data points as I expect they get these from the y Value arrays.

This is my function with test data:

B4X:
Private Sub InitGraphX1
    Private i As Int
 
    xGraph1.CurveYName(0) = "Voltage RMS"
    xGraph1.SetScaleManu(0, 220, 270)
    xGraph1.CurveYName(1) = "Frequency Hz"
    xGraph1.SetScaleManu(1, 48.5, 51.5)
 
    xGraph1.CurvesToDisplay.Initialize2(Array As Int(0, 1))
 
    Private x0 = -120 * 30 As Int
    Samples = NWServ.NO_SAMPLES
    xGraph1.NbSamples = Samples + 1
    For i = 0 To Samples
        xGraph1.CurveX(i) = (i + x0) / 30
        xGraph1.CurveY(0, i) = 1 * SinD(i * 0.1) + 247
        xGraph1.CurveY(1, i) = 0.1 * CosD(i * 0.1)
    Next
 

'    xGraph1.Title = "Test"
'    xGraph1.SetZoomIndexes(5, 295)
'    xGraph1.ScaleYValues = "1!3!10"
'    xGraph1.DisplayCurveUnit = False
'    xGraph1.DisplayCurveIndex = False

    xGraph1.DrawGraph
End Sub

Works fine on auto, but I don't want auto on this data as I want a consistent scaling that does not confuse the operator.

Best regards

Rob

Forgat the GIF
 

Attachments

  • EEE206C2-0933-466C-B520-660AA4571B16.GIF
    EEE206C2-0933-466C-B520-660AA4571B16.GIF
    461.8 KB · Views: 289
Upvote 0

rgarnett1955

Active Member
Licensed User
Longtime User
Hi,

Trying to use xGraph to display Power Line Voltage and frequency, but when I select manual scaling and provide the ranges the graphs don't display the lines.

The cursors show the data points as I expect they get these from the y Value arrays.

This is my function with test data:

B4X:
Private Sub InitGraphX1
    Private i As Int
  
    xGraph1.CurveYName(0) = "Voltage RMS"
    xGraph1.SetScaleManu(0, 220, 270)
    xGraph1.CurveYName(1) = "Frequency Hz"
    xGraph1.SetScaleManu(1, 48.5, 51.5)
  
    xGraph1.CurvesToDisplay.Initialize2(Array As Int(0, 1))
  
    Private x0 = -120 * 30 As Int
    Samples = NWServ.NO_SAMPLES
    xGraph1.NbSamples = Samples + 1
    For i = 0 To Samples
        xGraph1.CurveX(i) = (i + x0) / 30
        xGraph1.CurveY(0, i) = 1 * SinD(i * 0.1) + 247
        xGraph1.CurveY(1, i) = 0.1 * CosD(i * 0.1)
    Next
  

'    xGraph1.Title = "Test"
'    xGraph1.SetZoomIndexes(5, 295)
'    xGraph1.ScaleYValues = "1!3!10"
'    xGraph1.DisplayCurveUnit = False
'    xGraph1.DisplayCurveIndex = False

    xGraph1.DrawGraph
End Sub

Works fine on auto, but I don't want auto on this data as I want a consistent scaling that does not confuse the operator.

Best regards

Rob

Thank you for reporting this bug.
The class and b4xlib have been updated in the first post of the xGraph thread.


Thanks for that Klaus. All good now!

Best regards

Rob
 
Upvote 0
Top