Hi,
Does anybody have some experience in customizing scale labels? All I want to do is to make the most left x-sxale label left-bound - the most right bound label right bound - and keep all the other labels centered for multiscaled X-axis
How do I get it working also in zoom mode?
Thanks,
huh
customize scale labels
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi hugh,
Yes, you can do something like this:
Yes, you can do something like this:
Code: Select all
Private Sub Form_Load()
With TChart1.Series(0)
.Clear
.Add 123, "First", clTeeColor
.Add 456, "Second", clTeeColor
.Add 321, "Third", clTeeColor
.Add 234, "Last", clTeeColor
End With
End Sub
Private Sub TChart1_OnDrawAxisLabel(ByVal Axis As Long, ByVal X As Long, ByVal Y As Long, LabelText As String)
With TChart1
If Axis = 0 Then
If X = TChart1.Axis.Bottom.CalcXPosValue(TChart1.Axis.Bottom.Minimum) Then
.Canvas.Font.Bold = True
.Canvas.TextAlign = ctaLeft
Else
If X = TChart1.Axis.Bottom.CalcXPosValue(TChart1.Axis.Bottom.Maximum) Then ' // last label
.Canvas.Font.Bold = True
.Canvas.TextAlign = ctaRight
Else
.Canvas.Font.Bold = False
End If
End If
End If
End With
End Sub
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
customize scale labels
Thanks, Narcis
That works great for full scale - however how can I do the same while zooming - this way the maximum and minumum value comparison does not work anymore - How can I identify the first and last value to be modified while zooming?
Thanks,
Hugh
That works great for full scale - however how can I do the same while zooming - this way the maximum and minumum value comparison does not work anymore - How can I identify the first and last value to be modified while zooming?
Thanks,
Hugh
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Hugh,
You can do something like this:
For original labels to be restored when unzooming you'll be able to use the code below in the next v8 maintenance release:
If you are interested on that feature we can send you the .ocx with this new feature included.
You can do something like this:
Code: Select all
Private Sub Form_Load()
With TChart1.Series(0)
.Clear
.Add 123, "First", clTeeColor
.Add 456, "Second", clTeeColor
.Add 321, "Third", clTeeColor
.Add 234, "Last", clTeeColor
End With
End Sub
Private Sub TChart1_OnDrawAxisLabel(ByVal Axis As Long, ByVal X As Long, ByVal Y As Long, LabelText As String)
With TChart1
If Axis = 0 Then
If X = TChart1.Axis.Bottom.CalcXPosValue(TChart1.Axis.Bottom.Minimum) Then
.Canvas.Font.Bold = True
.Canvas.TextAlign = ctaLeft
Else
If X = TChart1.Axis.Bottom.CalcXPosValue(TChart1.Axis.Bottom.Maximum) Then ' // last label
.Canvas.Font.Bold = True
.Canvas.TextAlign = ctaRight
Else
.Canvas.Font.Bold = False
End If
End If
End If
End With
End Sub
Private Sub TChart1_OnZoom()
TChart1.Environment.InternalRepaint
With TChart1.Axis.Bottom
.Labels.Clear
For i = .Minimum To .Maximum
.Labels.Add i, CStr(i)
Next
.Labels.Add .Maximum, CStr(.Maximum)
End With
End Sub
Code: Select all
Private Sub TChart1_OnUndoZoom()
TChart1.Axis.Bottom.Labels.Automatic = True
TChart1.Repaint
End Sub
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi hugh,
Ok, I'll send you an e-mail with the URL to download it.
Remember you'll need to unregister old .ocx and register new one as described on this thread.
Ok, I'll send you an e-mail with the URL to download it.
Remember you'll need to unregister old .ocx and register new one as described on this thread.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |