Is it possible to set the axes at a defined point?
Eg. I want the axes in the center of the chart, at point (0, 0) of a particular serie, ala Cartesian axes.
Thanks.
Axis on origin
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi ACC,
Yes, you can easily get that by doing:
Yes, you can easily get that by doing:
Code: Select all
Private Sub Form_Load()
TChart1.Series(0).FillSampleValues 10
With TChart1.Axis
.Left.PositionUnits = puPercent
.Left.PositionPercent = 50
.Bottom.PositionUnits = puPercent
.Bottom.PositionPercent = 50
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 |
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi ACC,
There are a couple of ways to do that (enable or disable usePercentages) as done here:
There are a couple of ways to do that (enable or disable usePercentages) as done here:
Code: Select all
Private Sub Form_Load()
For i = -5 To 10
TChart1.Series(0).AddXY i, i, "", clTeeColor
Next i
TChart1.Panel.MarginUnits = muPixels
TChart1.Environment.InternalRepaint
End Sub
Private Sub TChart1_OnAfterDraw()
With TChart1.Axis
If usePercentages = True Then
chartWidth = .Right.Position - .Left.Position
horizZeroLoc = .Bottom.CalcXPosValue(0) - .Left.Position
horizPercentLoc = horizZeroLoc / chartWidth * 100
.Left.PositionUnits = puPercent
.Left.PositionPercent = horizPercentLoc
chartHeight = .Bottom.Position - .Top.Position
vertZeroLoc = .Left.CalcYPosValue(0) - .Top.Position
vertPercentLoc = vertZeroLoc / chartHeight * 100
.Bottom.PositionUnits = puPercent
.Bottom.PositionPercent = 100 - vertPercentLoc
Else
.Left.PositionUnits = puPixels
.Left.PositionPercent = .Bottom.CalcXPosValue(0) - .Left.Position
.Bottom.PositionUnits = puPixels
.Bottom.PositionPercent = .Bottom.Position - .Left.CalcYPosValue(0)
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 |