X Axis label not showing anything

TeeChart for ActiveX, COM and ASP
Post Reply
NCD
Newbie
Newbie
Posts: 1
Joined: Tue Apr 07, 2020 12:00 am

X Axis label not showing anything

Post by NCD » Wed May 13, 2020 8:06 am

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
Attachments
Add data arrays.7z
Complete sample
(170.21 KiB) Downloaded 1198 times

Yeray
Site Admin
Site Admin
Posts: 9509
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: X Axis label not showing anything

Post by Yeray » Wed May 20, 2020 9:04 am

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
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply