Page 1 of 1

X Axis label not showing anything

Posted: Wed May 13, 2020 8:06 am
by 16688431
I want to change the x axis labels shown.
I set SetStyle(talText);
I use "OnGetAxisLabelTchartSgpqWaveformView" to get the x label text.
However nothing is shown on the x axis.
The function is called because I can break point in there.

I have modified your "Add data arrays" sample file to include the changes, see the attached file.
For this example I just make the values negative.

Visual studio 2019
C++
windows 10
TeeChart2020_0_4_20_ActiveX3264

Re: X Axis label not showing anything

Posted: Wed May 20, 2020 9:04 am
by yeray
Hello,

We failed to make your project run in VS2019 but I believe we found what's the problem with it.
You are populating the series X and Y arrays but not the labels and you are setting the bottom axis to show the series labels when you set talText.
If you want to populate the series with AddArray and also want to have a label for each point, you can loop the series after populating it to assign the labels. Ie (VB6):

Code: Select all

  Dim MyXArray() As Double
  Dim MyYArray() As Double
  Dim MyLabels() As String
  ReDim MyYArray(10)
  ReDim MyXArray(10)
  ReDim MyLabels(10)
  
  MyXArray(0) = i
  MyYArray(0) = 25 + Rnd * 50
  MyLabels(0) = "label" + Str(MyXArray(0))
  For i = 1 To UBound(MyYArray) - 1
    MyXArray(i) = i
    MyYArray(i) = MyYArray(i - 1) + Rnd * 10 - 5
    MyLabels(i) = "label" + Str(MyXArray(i))
  Next i

  TChart1.AddSeries scLine
  With TChart1.Series(0)
    .AddArray UBound(MyYArray), MyYArray(), MyXArray()
  
    For i = 0 To .Count - 1
      If i < UBound(MyLabels) Then
        .PointLabel(i) = MyLabels(i)
      End If
    Next i
  End With